diff --git a/_share/media/img/albert/section-05/lesson-07/ex01.png b/_share/media/img/albert/section-05/lesson-07/ex01.png new file mode 100644 index 0000000..e950064 Binary files /dev/null and b/_share/media/img/albert/section-05/lesson-07/ex01.png differ diff --git a/_share/media/img/albert/section-05/lesson-07/ex02.png b/_share/media/img/albert/section-05/lesson-07/ex02.png new file mode 100644 index 0000000..7641211 Binary files /dev/null and b/_share/media/img/albert/section-05/lesson-07/ex02.png differ diff --git a/_subsections/sec05/lesson-07.org b/_subsections/sec05/lesson-07.org index 50926c7..135e88f 100644 --- a/_subsections/sec05/lesson-07.org +++ b/_subsections/sec05/lesson-07.org @@ -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 diff --git a/_subsections/sec05/lesson-08.org b/_subsections/sec05/lesson-08.org new file mode 100644 index 0000000..4cf4cd5 --- /dev/null +++ b/_subsections/sec05/lesson-08.org @@ -0,0 +1,9 @@ +#+title: Section 05 - Lesson 08 | Animation Player +#+HTML_HEAD: +#+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 diff --git a/toc.org b/toc.org index 0856de1..9bb8e8e 100755 --- a/toc.org +++ b/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]]