did the jump code, stub lesson 8 animation player
This commit is contained in:
parent
c59e28d3a8
commit
c5213e6b32
5 changed files with 51 additions and 0 deletions
BIN
_share/media/img/albert/section-05/lesson-07/ex01.png
Normal file
BIN
_share/media/img/albert/section-05/lesson-07/ex01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
BIN
_share/media/img/albert/section-05/lesson-07/ex02.png
Normal file
BIN
_share/media/img/albert/section-05/lesson-07/ex02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 102 KiB |
|
|
@ -7,3 +7,44 @@
|
|||
- [[https://www.udemy.com/course/jumpstart-to-2d-game-development-godot-4-for-beginners/learn/lecture/49010965#overview][S05:L07 - video]]
|
||||
|
||||
* Notes
|
||||
** making the plane jump
|
||||
- input action
|
||||
- jump const / variable
|
||||
- ONLY at the initial touch of jump, adjust the jump velocity
|
||||
|
||||
** add jump
|
||||
- create const variable to represent JUMP-POWER
|
||||
- add an action input
|
||||
- Project->Project Settings-> Input Map
|
||||
- in the "add new action" textbar enter the action name (jump)
|
||||
- hit the +Add button to the right of the "add new action" field
|
||||
|
||||
|
||||
#+attr_html: :width 600px
|
||||
file:../../_share/media/img/albert/section-05/lesson-07/ex01.png
|
||||
|
||||
- add event to action
|
||||
- hit the + to the right of the action name
|
||||
|
||||
#+attr_html: :width 600px
|
||||
file:../../_share/media/img/albert/section-05/lesson-07/ex02.png
|
||||
|
||||
- an event configuration dialog pops up, you can hit the keypress or choose whatever input will activate the action
|
||||
|
||||
** add code to check for the input
|
||||
- in ~_physics_process~
|
||||
- check for ~Input.is_action_just_pressed("name of action")~
|
||||
- and set ~velocity.y = JUMP_POWER~
|
||||
- physics engine will take care of the velocity changing due to gravity and distance
|
||||
|
||||
#+begin_src gdscript
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity.y += _gravity * delta
|
||||
|
||||
if Input.is_action_just_pressed("jump") == true:
|
||||
velocity.y = JUMP_POWER
|
||||
|
||||
# note we call move and slide over here to get the physics engine
|
||||
# to make it's calculations
|
||||
move_and_slide()
|
||||
#+end_src
|
||||
|
|
|
|||
9
_subsections/sec05/lesson-08.org
Normal file
9
_subsections/sec05/lesson-08.org
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#+title: Section 05 - Lesson 08 | 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/49010967#overview][S05:L08 - video]]
|
||||
|
||||
* Notes
|
||||
1
toc.org
1
toc.org
|
|
@ -42,3 +42,4 @@
|
|||
- [[./_subsections/sec05/lesson-05.org][Lesson 05 | Resources and the Plane]]
|
||||
- [[./_subsections/sec05/lesson-06.org][Lesson 06 | Plane Movement]]
|
||||
- [[./_subsections/sec05/lesson-07.org][Lesson 07 | Plane Jump Solution]]
|
||||
- [[./_subsections/sec05/lesson-08.org][Lesson 08 | Animation Player]]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue