Advertisement
otorp2

simple bouncing horz line

Dec 28th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1.  
  2. extends Node2D
  3.  
  4. var y = 0
  5. var yspeed = 1
  6. var screenheight = 200
  7. func _ready():
  8. set_process(true)
  9.  
  10. func _process(delta):
  11. update()
  12. func _draw():
  13.  
  14. draw_line(Vector2(0,y),Vector2(200,y),Color(255,0,0))
  15. y = y + yspeed
  16.  
  17. if(y > screenheight):
  18. yspeed-=1
  19. if(y < 0):
  20. yspeed+=1
  21. print(y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement