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

63 lines
2.1 KiB
Org Mode

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../../../../../_share/media/css/org-mode.css" />
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../_share/media/css/godot.css" />
#+title: Section 03 - Lesson 03 | Paddle Scene
* Links
- [[../../toc.org][TOC - Godot Notes]]
- [[https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginners/learn/lecture/45070459#overview][S03:L11.03 - Paddle Scene]]
* Notes
** scenes
there are three basic scenes we are going to create
1. Gem Scene
- Sprite2D
- CollisionShape2D
2. Paddle Scene
- Sprite2D
- CollisionShape2D
3. Game Scene
- Sprite2D
- Paddle Scene
- Timer
- ScoreLabel
- AudioStreamPLayer2D
- AudioStreamPlayer
*** creating a new scene
1. 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"
2. 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