2 KiB
Executable file
2 KiB
Executable file
Section 03 - Lesson 03 | Paddle Scene
Notes
scenes
there are three basic scenes we are going to create
-
Gem Scene
- Sprite2D
- CollisionShape2D
-
Paddle Scene
- Sprite2D
- CollisionShape2D
-
Game Scene
- Sprite2D
- Paddle Scene
- Timer
- ScoreLabel
- AudioStreamPLayer2D
- AudioStreamPlayer
creating a new scene
-
go to the top of the center pane, and click on the plus.
- this creates an empty unsaved scene
-
you must create a new root node.
- click the '+' symbol in the upper left scene pane
- search for Area2D: "a region of 2D space that detects other CollesionObject2Ds enteriinig or exiting it"
-
Menu->Scene->New Scene
- select a root node, ie 2DScene - which will set your root node as a Node2D
- or create one via the "+"
using a Area2D root node
-
you must add a shape so the root node can interact with other objects and detect collisions or overlaps
- CollisionShape2D
- CollisionPolygon2D
add collisoinshape2D
- "+" -> CollisionShape2D
-
add a shape
- CollsionsShape2D node -> Inspector -> CollisionShape2D -> Shape -> <choose from dropdown>
add sprite2D
- the shape is only for background processing
- "+" -> Sprite2D
- drag and drop an image into Inspector->Sprite2D->Texture
refitting the collision shape
- currently the collision shape is being drawn first, then the sprite on top of it
- reorder so that the sprite gets drawn first, then the colision shape
- resize the collision shape, use transform if you need to
add paddle to game scene
- go to the game scene
- click the chain button in the upper left scene pain, the chain button is to the right of the "+"
- select which scene you want to add