Advertisement
otorp2

simple gravity

Dec 26th, 2016
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1.  
  2. extends Node2D
  3.  
  4. var y = 0
  5. var speed = 0
  6. var gravity = .01
  7.  
  8.  
  9. func _ready():
  10. set_process(true)
  11. pass
  12.  
  13. func _process(delta):
  14. y = y + speed
  15. speed = speed + gravity
  16. get_node("ship").set_pos(Vector2(150,y))
  17. print(y)
  18. if y > 400:
  19. speed = speed * - .95
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement