Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. function hero.update(dt)
  2.  
  3.  
  4.  
  5.  
  6. if hero.y >= 0 then
  7. if love.keyboard.isDown("up") then
  8. hero.vy = 200
  9. hero.y = hero.y - (hero.vy*dt)
  10. end
  11. else
  12. hero.y = 0
  13. end
  14.  
  15. if hero.x <= 556 then
  16. if love.keyboard.isDown("right") then
  17. hero.vx = 200
  18. hero.x = hero.x + (hero.vx*dt)
  19. end
  20. else
  21. hero.x = 556
  22. end
  23.  
  24. if hero.y <= 559 then
  25. if love.keyboard.isDown("down") then
  26. hero.vy = 200
  27. hero.y = hero.y + (hero.vy*dt)
  28. end
  29. else
  30. hero.y = 559
  31. end
  32.  
  33. if hero.x >= 0 then
  34. if love.keyboard.isDown("left") then
  35. hero.vx = 200
  36. hero.x = hero.x - (hero.vx*dt)
  37. end
  38. else
  39. hero.x = 0
  40. end
  41.  
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement