finished spawning
This commit is contained in:
parent
4c058548ab
commit
0084ca254e
2 changed files with 64 additions and 3 deletions
|
|
@ -1,9 +1,70 @@
|
|||
#+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 13 | Spawn Timer
|
||||
#+title: Section 03 - Lesson 13, 14 | Spawn Timer, Spawning gems
|
||||
|
||||
* Links
|
||||
- [[../../toc.org][TOC - Godot Notes]]
|
||||
- [[https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginners/learn/lecture/45070483#announcements][S03:L22.13 - Spawn Timer]]
|
||||
- [[https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginners/learn/lecture/45070483#announcements][S03:L24.13 - Spawn Timer]]
|
||||
- [[https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginners/learn/lecture/45070485#announcements][S03:L25.14 - Spawning Gems]]
|
||||
|
||||
* Notes
|
||||
|
||||
** removing connected nodes
|
||||
- nodes that are connected must be disconnected before deletion
|
||||
- otherwise strange things happen
|
||||
|
||||
** Timing
|
||||
- add a child node
|
||||
- search for Timer
|
||||
|
||||
*** properties
|
||||
- autostart: whether it starts as soon as scene is ready in tree
|
||||
- one shot: time once and stop
|
||||
- wait time: the actual time it goes
|
||||
|
||||
*** signals
|
||||
- timeout
|
||||
- got to Inspector->Node
|
||||
- timeout emits a signal when the wait time hits zero
|
||||
|
||||
** Spawning Gems
|
||||
|
||||
Put the following in the script that you want to create nodes in based on a scene:
|
||||
|
||||
#+BEGIN_SRC gdscript
|
||||
@export var gem_scene: PackedScene
|
||||
#+END_SRC
|
||||
|
||||
*** terms
|
||||
- =@export=
|
||||
- makes the variable accessible and modifiable from the Godot editor
|
||||
- allows assigning variables through the interface
|
||||
|
||||
#+ATTR_HTML: :width 300px
|
||||
[[file:../../../_share/media/albert/img/section03/S03_L15_EX01.png]]
|
||||
|
||||
- =PackedScene=
|
||||
- resource that holds a scene in a packed, ready to load state
|
||||
|
||||
*** what it does
|
||||
allows us to create instances of the scene
|
||||
|
||||
- drag a scene into the property in the inspector
|
||||
- call instance
|
||||
|
||||
#+BEGIN_SRC gdscript
|
||||
func spawn_gem() -> void:
|
||||
var gem_instance = gem_scene.instance()
|
||||
add_child(gem_instance)
|
||||
#+END_SRC
|
||||
|
||||
** how to explicitly assign the type of a custom script
|
||||
- in the script near the top type in
|
||||
#+BEGIN_SRC gdscript
|
||||
class_name CustomName
|
||||
#+END_SRC
|
||||
|
||||
- then override on assigning the value
|
||||
#+BEGIN_SRC gdscript
|
||||
var new_gem: CustomName = gem_scene.instantiate()
|
||||
#+END_SRC
|
||||
|
|
|
|||
2
toc.org
2
toc.org
|
|
@ -19,4 +19,4 @@ https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginn
|
|||
*** [[./_subsections/sec03/lesson-07.org][Lesson 07, 08 | Moving the Gem, Removing the Gem]]
|
||||
*** [[./_subsections/sec03/lesson-09.org][Lesson 09 | Export Annotation]]
|
||||
*** [[./_subsections/sec03/lesson-11.org][Lesson 11, 12 | Signals, Custom Signals]]
|
||||
*** [[./_subsections/sec03/lesson-13.org][Lesson 13 | Spawn Timer]]
|
||||
*** [[./_subsections/sec03/lesson-13.org][Lesson 13, 14 | Spawn Timer, Spawning items]]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue