ScriptOOP.tscn 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. [gd_scene load_steps=6 format=3 uid="uid://mafppe6pavvi"]
  2. [ext_resource type="Script" path="res://addons/slide_show/projector/slide/Slide.gd" id="1_wmeyv"]
  3. [ext_resource type="Texture2D" uid="uid://ow45ugvbarxo" path="res://slides/274/ResourcePreloader.svg" id="2_uose8"]
  4. [ext_resource type="PackedScene" uid="uid://bvrtmyq4g1qes" path="res://common/components/title/title.tscn" id="3_corcb"]
  5. [ext_resource type="Texture2D" uid="uid://bo1tq5h0gwnik" path="res://slides/274/editor_gd4_inheritance_rigidbody.png" id="5_sq1r2"]
  6. [sub_resource type="CodeHighlighter" id="CodeHighlighter_2654d"]
  7. number_color = Color(0.803922, 0, 0.803922, 1)
  8. symbol_color = Color(0, 0, 1, 1)
  9. function_color = Color(0, 0.615686, 0, 1)
  10. member_variable_color = Color(0.8, 0.5, 0, 1)
  11. keyword_colors = {
  12. "InputEvent": Color(0, 0.4, 0, 1),
  13. "RigidBody2D": Color(0, 0.4, 0, 1),
  14. "String": Color(0, 0.4, 0, 1),
  15. "Vector2": Color(0, 0.4, 0, 1),
  16. "and": Color(1, 0, 0, 1),
  17. "bool": Color(1, 0, 0, 1),
  18. "class": Color(1, 0, 0, 1),
  19. "class_name": Color(1, 0, 0, 1),
  20. "extends": Color(1, 0, 0, 1),
  21. "float": Color(1, 0, 0, 1),
  22. "for": Color(1, 0, 0, 1),
  23. "func": Color(1, 0, 0, 1),
  24. "if": Color(1, 0, 0, 1),
  25. "in": Color(1, 0, 0, 1),
  26. "int": Color(1, 0, 0, 1),
  27. "return": Color(1, 0, 0, 1),
  28. "signal": Color(1, 0, 0, 1),
  29. "var": Color(1, 0, 0, 1)
  30. }
  31. [node name="ScriptOOP" type="Node2D"]
  32. script = ExtResource("1_wmeyv")
  33. [node name="PackageIcon" type="Sprite2D" parent="."]
  34. modulate = Color(1, 0.411765, 1, 1)
  35. position = Vector2(914, 121)
  36. texture = ExtResource("2_uose8")
  37. [node name="Title" parent="." instance=ExtResource("3_corcb")]
  38. offset_left = 5.0
  39. offset_top = 28.0
  40. offset_right = 860.0
  41. offset_bottom = 196.0
  42. text = "Orienté objet"
  43. [node name="GdScriptEdit" type="CodeEdit" parent="."]
  44. offset_left = 1011.0
  45. offset_top = 18.0
  46. offset_right = 1895.0
  47. offset_bottom = 1064.0
  48. theme_override_colors/background_color = Color(1, 1, 1, 1)
  49. theme_override_colors/font_color = Color(0, 0, 0, 1)
  50. theme_override_font_sizes/font_size = 46
  51. text = "class_name Penguin
  52. extends RigidBody2D
  53. # My amazing main character
  54. var speed: float = 0.0 # km/h
  55. func _ready():
  56. speed = 10.0
  57. for increment in range(4):
  58. accelerate()
  59. if penguin_speed > 100:
  60. print(\"Tux flies!\")
  61. func accelerate() -> void:
  62. speed = speed + 2.0"
  63. deselect_on_focus_loss_enabled = false
  64. virtual_keyboard_enabled = false
  65. syntax_highlighter = SubResource("CodeHighlighter_2654d")
  66. gutters_draw_line_numbers = true
  67. indent_use_spaces = true
  68. [node name="Inheritance" type="Sprite2D" parent="."]
  69. position = Vector2(447.5, 641.8)
  70. scale = Vector2(3.225, 3.225)
  71. texture = ExtResource("5_sq1r2")