Control.tscn 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. [gd_scene load_steps=3 format=1]
  2. [ext_resource path="res://data/images/background/arcticskies1.png" type="Texture" id=1]
  3. [sub_resource type="GDScript" id=1]
  4. script/source = "extends Control\n\nvar tapped=false\nvar intersects = false\n\nvar r = Rect2( Vector2(), get_size() )\n\nfunc _draw():\n\n if (tapped):\n draw_rect(r, Color(1,0,0) )\n else:\n draw_rect(r, Color(0,0,1) )\n\n if (intersects):\n draw_rect(r, Color(0, 1, 0))\n\nfunc _input_event(ev):\n\n if (ev.type==InputEvent.MOUSE_BUTTON and ev.pressed):\n tapped=true\n update()\n if (r.has_point(ev.pos)):\n intersects=true\n update()"
  5. [node name="Control" type="Control"]
  6. focus/ignore_mouse = false
  7. focus/stop_mouse = true
  8. size_flags/horizontal = 2
  9. size_flags/vertical = 2
  10. margin/left = 77.0
  11. margin/top = 40.0
  12. margin/right = 954.0
  13. margin/bottom = 414.0
  14. script/script = SubResource( 1 )
  15. [node name="CanvasLayer" type="CanvasLayer" parent="."]
  16. layer = 1
  17. offset = Vector2( 0, 0 )
  18. rotation = 0.0
  19. scale = Vector2( 1, 1 )
  20. [node name="Sprite" type="Sprite" parent="CanvasLayer"]
  21. transform/pos = Vector2( 0, 2153.9 )
  22. transform/scale = Vector2( 100, -30.8785 )
  23. texture = ExtResource( 1 )
  24. region = true
  25. region_rect = Rect2( 0, 0, 100, 100 )