Advertisement
otorp2

viewport get mousepos and grid

Dec 26th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2. extends Node2D
  3.  
  4. # member variables here, example:
  5. # var a=2
  6. # var b="textvar"
  7. var width = 10
  8. var height = 10
  9. var mousex
  10. func _ready():
  11. # update()
  12. set_process(true)
  13. pass
  14. func _process(delta):
  15.  
  16. update()
  17.  
  18.  
  19.  
  20. pass
  21. func _draw():
  22. mousex = get_viewport().get_mouse_pos()
  23.  
  24. if mousex.x > 200 and mousex.x < 250:
  25. draw_line(Vector2(0,0),Vector2(300,300),Color(255,100,0),5)
  26.  
  27. # for i in range(10):
  28. # draw_circle(Vector2(width,50),10,Color(255,0,0))
  29. #
  30. # width += 56
  31. # for j in range(10):
  32. # draw_circle(Vector2(50,height),10,Color(0,255,0))
  33. # height +=100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement