Compare commits

..

No commits in common. "c59e28d3a8156577ead9c279e579c5a5753c19e2" and "51f58bb19fd86111c201b96acadbb9b83a1a379d" have entirely different histories.

4 changed files with 2 additions and 113 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

View file

@ -1,5 +1,5 @@
#+title: Section 05 - Lesson 06 | Plane Movement
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../_share/media/css/godot.css" />
#+title:Flyin#+title: Section 05 - Lesson 06 | Plane Movement
#+HTML_HEAD: <link rel="stylesheet" type="text/css" hare/media/css/godot.css" />
#+OPTIONS: H:6
* Links
@ -9,104 +9,3 @@
* Notes
- the more complex the collision shape the more computations
- if you concentrate on good games, you'll notice the collisions are actually straightforward
** collision shape
*** adding a collision shape
- click on root node
- add child CollisionShape2D
- pane scene->collision_shape_2D
- pane inspector->CollisionShape2D->Shape
- select new CircleShape2D
- use shape handles to adjust
*** issues with collisions
- we want the collision shape to be good
- but the more complex the collision the more computations
- focus on the game flow, not perfecting the modeling
*** circle shape resource
- click inside the Shape dropdown on the CircleShape2D item
- it will open up and show you details about CircleShape2D
- radius
- resource
- local to scene
- path
- name
- currently the resource is embedded in the scene
**** if you want to save the resource for reuse
- click on the arrow next to the Shape dropdown
- click save or save as
** add a script
- SELECT THE ROOT NODE "plane"
- click on the Scene green plus to add a script
#+attr_html: :width 600
file:../../_share/media/img/albert/section-05/lesson-06/ex_01a.png
*** in dialog
- template: select Node default
- built in script: off
*** coding
- in a phsycis body we just give vectors
- let the physics engine deal with positioning
- CharacterBody2D has a velocity variable which you can set
- Vector2D velocity
- x, y
- how much we want to move in x and y
- function bool move_and_slide()
- updates our position
- updates the velocity if we collide with something
- after move_and_slide has been invoked we call other funcitons
- is_on_ceiling
- is_on_floor
- etc
- upDirection method sets what is "up"
- default x: 0, y: -1
- (0, 1) ceiling is now floor
- (1, 0) the left side is the ceiling
*** default gravity
- you can access gravity from Project Settings
#+begin_src gdscript
var _gravity: float = ProjectSettings.get("physics/2d/default_gravity")
#+end_src
*** manipulating physics nodes
- use _physics_process instead of _process
- process is invoked every frame
- physics process is invoked at about half that rate
** creating boundaries
*** create barrier scene
**** initialize the scene
- create a new scene
- don't select one of the default nodes as the root
- use the + symbol in Scene to select a StaticBody2D as the root node
**** add boundaries
- create 2 CollisionShape2D nodes
- on each set shape to WorldBoundaryShape2D
- lower node
- move the boundary to the bottom of the viewing area
- top node
- move the boundary a little bit above so as to give the plane some room to bounce through the ceiling
- click on the Shape dropdown of WorldShape2D to open additional values
- set the direction to down
- in Normal, change y from -1 to 1, so it points down instead of up
- save scene
*** add barrier to game scene
- instantiate as a child node in the game scene

View file

@ -1,9 +0,0 @@
#+title: Section 05 - Lesson 07 | Plane Jump Movement
#+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/49010965#overview][S05:L07 - video]]
* Notes

View file

@ -41,4 +41,3 @@
- [[./_subsections/sec05/lesson-04.org][Lesson 04 | Physics Nodes Review]]
- [[./_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]]