Creating our Projectile

Now we need a projectile that our player can launch towards the puzzle pieces to damage them. The projectile node hierarchy will be very similar to the puzzle pieces.

Learning Goals

  • How to apply forces to RigidBody2D nodes to create realistic physics behavior
  • How to tweak physics parameters like Bounce and Friction to achieve your desired effect
  • Learn how Gravity affects physics bodies in a scene
  • Using a Line2D to quickly visualize aspects of your game world
  • Destroy the projectile after a set life span using a Timer node

Requirements

  • Projectiles interact with physics realistically
    • Collisions work as expected
    • Gravity is respected
  • The player should be able to launch the projectile towards the puzzle pieces
  • The player should have some idea of the force and direction of each shot, allowing them to adjust their strategy based on the results
  • The projectile should apply damage to the physics body it collided with
  • Projectile should be destroyed shortly after an impact with any other body
  • Projectiles should be destroyed five seconds after launch, regardless of collision status
Creating our Projectile
Building the Scene
Configure the Child Nodes