ScriptOOP.tscn 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [gd_scene load_steps=6 format=3 uid="uid://mafppe6pavvi"]
  2. [ext_resource type="Script" path="res://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="PackedScene" uid="uid://dogtm6fdbp3wl" path="res://common/components/gdedit/GdScriptEdit.tscn" id="4_t16pa"]
  6. [ext_resource type="Texture2D" uid="uid://bo1tq5h0gwnik" path="res://slides/274/editor_gd4_inheritance_rigidbody.png" id="5_sq1r2"]
  7. [node name="ScriptOOP" type="Node2D"]
  8. script = ExtResource("1_wmeyv")
  9. [node name="PackageIcon" type="Sprite2D" parent="."]
  10. modulate = Color(1, 0.411765, 1, 1)
  11. position = Vector2(914, 121)
  12. texture = ExtResource("2_uose8")
  13. [node name="Title" parent="." instance=ExtResource("3_corcb")]
  14. offset_left = 5.0
  15. offset_top = 28.0
  16. offset_right = 860.0
  17. offset_bottom = 196.0
  18. text = "Orienté objet"
  19. [node name="GdScriptEdit" parent="." instance=ExtResource("4_t16pa")]
  20. offset_left = 1011.0
  21. offset_top = 18.0
  22. offset_right = 1895.0
  23. offset_bottom = 1064.0
  24. text = "class_name Penguin
  25. extends RigidBody2D
  26. # My amazing main character
  27. var speed: float = 0.0 # km/h
  28. func _ready():
  29. speed = 10.0
  30. for increment in range(4):
  31. accelerate()
  32. if penguin_speed > 100:
  33. print(\"Tux flies!\")
  34. func accelerate() -> void:
  35. speed = speed + 2.0"
  36. [node name="Inheritance" type="Sprite2D" parent="."]
  37. position = Vector2(447.5, 641.8)
  38. scale = Vector2(3.225, 3.225)
  39. texture = ExtResource("5_sq1r2")