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--