#+title: Section 04 - Lesson 03 | Physics 2D Nodes #+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/45069801#overview][S04:L45.03 - video]] * Notes ** overview *** assets 1. sprite sheet plane, 3 figures 2. pipe and laser site 3. some backgrounds for parallax effect *** scenes 1. main game scene 2. plane sceen 3. pipes scene (2 pipes) 4. laser scene *** approach - make the basic game scene - make a plance scene - code plane movement - build the pipe / laser / pipes scene - setup the scrolling logic - setup collishions and plane death - create the main screen and setup navigation - add game over - add scoring with high score saving - parallax background *** plane scene - falls with gravity - press a key to jump or fly - collides with laser, pipes, floor, ceiling - animated propellor ** physics *** overview - gravity - collisions - movement - forces - impulse - get hit by a rocket *** physics 2D nodes #+attr_html: :class two-column-definitions | node type | definition | |------------------+---------------------------------------------------------------------------------------------------------------------------------| | StaticBody2D | Physics body for 2D physics which is static or moves only by script. Useful for floor and walls. | | CharacterBody2D | Specialized 2D physics body node for characters moved by script | | AnimatableBody2D | Physics body for 2D physics which moves only by script or animation. Useful for moving platforms and doors | | RigidBody2D | Physics body which is moved by 2D physics simulation. Useful for objects that have gravity and can be pushed by other objects. | **** StaticBody2D - wall, rock, ceiling floor, platform in the middle of the level - designed not to move - things will bounce or stick to it depending on what your physics is **** CharacterBody2D - think platform character - set the velocities **** AnimatableBody2D - inherits from StaticBody2D - getting a StaticBody and a Character to move together is a pain and buggy **** RigidBody2D - tennis ball - rocket fired *** how they interact - interact with other Physics2D nodes - we DO NOT control the position, the physics engine does - we supply velocity / force - physics engine calculates where we go and what our speed / position is