Kingdaro

yvel/jumping example

May 6th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.23 KB | None | 0 0
  1. function love.load()
  2.     obj = {x=0, y=0, yvel=0}
  3.     gravity = 800
  4. end
  5.  
  6. function love.update(dt)
  7.     obj.y = obj.y + obj.yvel
  8.     obj.yvel = obj.yvel + gravity*dt
  9. end
  10.  
  11. function love.draw()
  12.     love.graphics.rectangle(obj.x,obj.y,50,50)
  13. end
Advertisement
Add Comment
Please, Sign In to add comment