Having trouble coding a point and click coding
Posted: Tue Feb 25, 2014 8:51 am
I'm building a test Beta Demo of my Seek & Destory Engine that has similar functions to Command and Conquer Red Alert's Engine, I'm not sure if it's or something else to click once on an object like a circle and then click again to move it the spot where it was clicked to like for exmaple it moves to area 120, 40 and stops at the clicked point. this is fromMunkeeBacon's tutorial from youtube to use a key to move the cicle when I've done it with the mouse.isdown code it just gives no circle just a blank screen.
here's the Code I followed from him to make with my own mod to use the mouse clicks not from pressing a key like Left Arrow key
not sure why I'm getting a blank screen is there something missing from the Main.lua file?
- empty as is.
Code: Select all
love.mouse.isdown
here's the Code I followed from him to make with my own mod to use the mouse clicks not from pressing a key like Left Arrow key
Code: Select all
player = {}
function player.load()
player.x = 5
player.y = 5
player.xvel = 0
player.yvel = 0
player.friction = 7
player.speed = 2300
player.width 50
player.height 50
end
function player.draw()
love.graphics.setcolor (150,255,0)
love.graphics.rectangle("fill", player.x, player.y,player.width,player.height)
end
function player.physics(dt)
player.x = player.x + player.xvel = dt
player.y = player.y + player.yvel = dt
player.xvel = player.xvel = (1 = math.min(dt*player.friction, 1))
end
function update_player(dt)
player.physics(dt)
end
function draw_player()
player.draw
end
function player.move(dt)
if love.mouse.isdown ("l") and
player.xvel < player.speed then
player.xvel = player.xvel + player.speed + dt
end
if love.mouse.isdown("l") then
player.xvel > -player.xvel - player.speed + dt
end
Code: Select all
--[[You may modify the game's files as long you do it under the
the share license to share-alike and the other stuff within the license now have fun using my game's code
as long you don't mess it around too much!]]
function love.load()
end
--Required Lua Files Here--