2025-02-19 03:38:14 +02:00
|
|
|
#+title: Section 04 - Lesson 04 | plane scene and resources
|
|
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../_share/media/css/godot.css" />
|
|
|
|
|
#+OPTIONS: H:6
|
|
|
|
|
|
|
|
|
|
* Links
|
|
|
|
|
- [[../../toc.org][TOC - Godot Notes]]
|
|
|
|
|
- [[https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginners/learn/lecture/45069803#overview][S04:L49.04 - video]]
|
|
|
|
|
|
|
|
|
|
* Notes
|
2025-02-23 04:10:57 +02:00
|
|
|
** create plane scene
|
|
|
|
|
- create a scene 'plane'
|
|
|
|
|
- CharacterBody2D as root node
|
|
|
|
|
- change the node name to "Plane" (unnecessary but why not)
|
|
|
|
|
|
|
|
|
|
** character body 2D plane node
|
|
|
|
|
- Sprite to animate the 3 frames
|
|
|
|
|
- CollisionShape2D for physics
|
|
|
|
|
- AnimationPlayer to animate the rotation of the plane
|
|
|
|
|
- EngineSound (audio? node?)
|
|
|
|
|
|
|
|
|
|
** animated sprite 2D
|
|
|
|
|
- add it
|
|
|
|
|
- rename it to Sprite
|
|
|
|
|
|
|
|
|
|
*** create a sprite frames resource
|
|
|
|
|
- go to Inspector->AnimatedSprite2D->Animation
|
|
|
|
|
- click on sprite frames drop down and select "new Sprite Frames"
|
|
|
|
|
- go back to drop down, and click on the sprite frame box
|
|
|
|
|
#+attr_html: :width 200px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX01.png
|
|
|
|
|
|
|
|
|
|
- this will open up the following window
|
|
|
|
|
|
|
|
|
|
#+attr_html: :width 600px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX02.png
|
|
|
|
|
|
|
|
|
|
- notice
|
|
|
|
|
- 'spriteframes' tab is selected
|
|
|
|
|
- "default" animation
|
|
|
|
|
- 5 frames per second
|
|
|
|
|
- set to loop continuously
|
|
|
|
|
|
|
|
|
|
*** animation frame editor
|
|
|
|
|
**** buttons
|
|
|
|
|
1. playback controls
|
|
|
|
|
2. buttons to add in frames
|
|
|
|
|
- individually
|
|
|
|
|
- by sprite sheet
|
|
|
|
|
3. copy and paste frames
|
|
|
|
|
4. insert empty frames
|
|
|
|
|
5. move frames around
|
|
|
|
|
6. delete frames
|
|
|
|
|
|
|
|
|
|
#+attr_html: :width 600px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX03.png
|
2025-02-23 22:07:38 +02:00
|
|
|
|
|
|
|
|
**** frame duration
|
|
|
|
|
- the frame duration textbox allows you to set the duration of a specific frame
|
|
|
|
|
- this is apparently done by time
|
|
|
|
|
|
|
|
|
|
*** adding frames
|
|
|
|
|
- click on the add frames button
|
|
|
|
|
#+attr_html: :width 600px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX04a.png
|
|
|
|
|
|
|
|
|
|
- add a sprite sheet
|
|
|
|
|
- resize the sprite grid so godot can know what the sprites are
|
|
|
|
|
#+attr_html: :width 600px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX04b.png
|
|
|
|
|
|
|
|
|
|
- when you are satisfied with the frames available, select all and add the frames
|
|
|
|
|
#+attr_html: :width 600px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX04c.png
|
|
|
|
|
|
|
|
|
|
** resources
|
|
|
|
|
- currently the sprite we created is embedded as an internal resource to our plane scene
|
|
|
|
|
- if you save it, then the information regarding the frames will be moved to that tres file you saved
|
|
|
|
|
- allows you to reuse the frame resource
|
|
|
|
|
|
|
|
|
|
*** saving the sprite frame as a resource
|
|
|
|
|
- click on Inspector->AnimatedSprite2D->Animation->Sprite Frame drop down arrow
|
|
|
|
|
- in the pop up menu click on 'save as'
|
|
|
|
|
|
|
|
|
|
#+attr_html: :width 300px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX05.png
|
|
|
|
|
|
|
|
|
|
** NOTE: if the plane is too large (or small)
|
|
|
|
|
- go to the plane scene
|
|
|
|
|
- select the AnimatedSprite2D from the scene menu
|
|
|
|
|
- go to Inspector->Node2D->Transform->Scale
|
|
|
|
|
- change values as appropriate
|
|
|
|
|
|
|
|
|
|
** add the plane scene
|
|
|
|
|
1. go to the game scene
|
|
|
|
|
2. click on the 'instantiate child node'
|
|
|
|
|
#+attr_html: :width 300px
|
|
|
|
|
file:../../_share/media/img/section04/lesson04/EX06a.png
|
|
|
|
|
|
|
|
|
|
3. from dialog popup, select the plane.tscn scene
|