Advertisement
otorp2

3 white boxes one black

Jan 1st, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. extends Node2D
  2.  
  3. # member variables here, example:
  4. # var a=2
  5. # var b="textvar"
  6. var mousepos
  7. var screenx = 200
  8. var screeny = 200
  9. func _ready():
  10.  
  11. set_process(true)
  12. pass
  13.  
  14. func _process(delta):
  15.  
  16. update()
  17.  
  18.  
  19.  
  20. func _draw():
  21. mousepos = get_viewport().get_mouse_pos()
  22. draw_rect(Rect2(0,0,screenx,screeny),Color(255,255,255))
  23. draw_line(Vector2(0,screeny*.5),Vector2(screenx,screeny*.5),Color(0,0,0))
  24. draw_line(Vector2(screenx*.5,0),Vector2(screenx*.5,screeny),Color(0,0,0))
  25. if mousepos.x < 100 and mousepos.y < 100:
  26. draw_rect(Rect2(0,0,100,100),Color(0,0,0))
  27. elif mousepos.x > 100 and mousepos.y < 100:
  28. draw_rect(Rect2(100,0,100,100),Color(0,0,0))
  29. elif mousepos.x < 100 and mousepos.y > 100:
  30. draw_rect(Rect2(0,100,100,100),Color(0,0,0))
  31. elif mousepos.x > 100 and mousepos.y > 100:
  32. draw_rect(Rect2(100,100,100,100),Color(0,0,0))
  33. print(mousepos)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement