compsci_godot_albert/_subsections/sec03/lesson-04.org
2024-11-27 04:24:34 +02:00

1.2 KiB

Section 03 - Lesson 04 | Gem Scene

Notes

quick recap

create a Gem Scene

  1. Create a new Scene

    • instead of hitting 2D, hit "+" and choose Area2D
  2. Create a Sprite2D child

    • get element_red_diamond.png
    • Sprite2D->Inspector->Sprite2D->Texture
  3. Create a CollisionShape2D child under Sprite2D

    • Inspector->CollisionShape2D->shape , choose RectangleShape2D
  4. Rotate the CollisionShape2D 45 degrees

    • Inspector->Node2D->Transform->Rotation
    • set rotation to 45
  5. Increase the size of the collision shape

    • Inspector->CollisionShape2D->Shape click INSIDE the dropdown area
    • it will show size, set the size to 35, 35

add the Gem Scene to the Game

  1. Go to the Game scene
  2. Hit the "Instatiate Child Scene" button or press Shift+Command+A
  3. Add the Gem Scene as a node
  4. Move the object somewhere else on the screen