move sprite to player

This commit is contained in:
Tyrel Souza 2018-01-17 23:23:06 -05:00
parent 8574888e18
commit 0a80fecf12
2 changed files with 7 additions and 2 deletions

View File

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

View File

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