move sprite to player
This commit is contained in:
parent
8574888e18
commit
0a80fecf12
2
main.lua
2
main.lua
@ -55,9 +55,7 @@ end
|
|||||||
|
|
||||||
function beginContact(a, b, coll)
|
function beginContact(a, b, coll)
|
||||||
player.grounded = true
|
player.grounded = true
|
||||||
player.sprite = sprites.player_stand
|
|
||||||
end
|
end
|
||||||
function endContact(a, b, coll)
|
function endContact(a, b, coll)
|
||||||
player.grounded = false
|
player.grounded = false
|
||||||
player.sprite = sprites.player_jump
|
|
||||||
end
|
end
|
||||||
|
@ -19,4 +19,11 @@ function playerUpdate(dt)
|
|||||||
player.body:setX(player.body:getX() + player.speed * dt)
|
player.body:setX(player.body:getX() + player.speed * dt)
|
||||||
player.direction = DIRECTION_RIGHT
|
player.direction = DIRECTION_RIGHT
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if player.grounded == true then
|
||||||
|
player.sprite = sprites.player_stand
|
||||||
|
else
|
||||||
|
player.sprite = sprites.player_jump
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user