added flying
This commit is contained in:
parent
d8ec76c5f5
commit
38c2443185
3 changed files with 58 additions and 0 deletions
|
|
@ -7,3 +7,51 @@
|
|||
- [[https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginners/learn/lecture/45069817#overview][S04:L53.08 - video]]
|
||||
|
||||
* Notes
|
||||
|
||||
** when a character body2d hits the floor
|
||||
- velocity is set to 0
|
||||
- is_on_floor is set to true
|
||||
|
||||
** create a floor
|
||||
to create a floor we are going to use a StaticBody2D
|
||||
|
||||
|
||||
1. make this as a seperate scene
|
||||
2. add root node StaticBody2D
|
||||
3. add CollisionShape2D as child
|
||||
4. in collisionshape2D inspector go to shape and pick rectangle shape
|
||||
5. stretch the rectangle across the scene
|
||||
6. save scene
|
||||
|
||||
** add barrier to game
|
||||
1. add the barrier scene to the game scene
|
||||
2. put it at top of screen or whereever you like
|
||||
3. Ctrl+D to create another one and move it to the floor
|
||||
|
||||
** when plane hits floor stop it from moving
|
||||
- in physics process func check if 'in on floor'
|
||||
- if so than invoke die
|
||||
|
||||
#+BEGIN_SRC gdscript
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
||||
# ...
|
||||
|
||||
if is_on_floor() == true:
|
||||
die()
|
||||
|
||||
func die() -> void:
|
||||
set_physics_process(false)
|
||||
#+end_src
|
||||
|
||||
** end properller animation
|
||||
- switch to plane scene
|
||||
- Cmd + drag AnimationSprite to script
|
||||
- in die set the variable to the sprite to 'stop()'
|
||||
|
||||
#+BEGIN_SRC gdscript
|
||||
func die() -> void:
|
||||
set_physics_process(false)
|
||||
animated_spirte_2d.stop()
|
||||
#+end_src
|
||||
|
|
|
|||
9
_subsections/sec04/lesson-09.org
Normal file
9
_subsections/sec04/lesson-09.org
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#+title:Flyin#+title: Section 14 - Lesson 09 | Animation Player
|
||||
#+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/45069817#overview][S14:L09 - video]]
|
||||
|
||||
* Notes
|
||||
1
toc.org
1
toc.org
|
|
@ -32,3 +32,4 @@
|
|||
- [[./_subsections/sec04/lesson-05.org][Lesson 05, 06 | Collision Shapes and Resources, Falling]]
|
||||
- [[./_subsections/sec04/lesson-07.org][Lesson 07 | Flying]]
|
||||
- [[./_subsections/sec04/lesson-08.org][Lesson 08 | Collisions: Hitting the Floor]]
|
||||
- [[./_subsections/sec04/lesson-09.org][Lesson 09 | Animation Player]]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue