Godot
Physical Objects

A rigidbody is a physical object that falls, bounces etc.

A staticbody is a physical object that does not move.

Both of the above need to have the following child nodes:

  • Sprite or AnimatedSprite (so you can see the object)
  • Collision (to define the physical shape)
Create a physical object
Use a button to apply an impulse
Add and play animations (or more detailed explanation, including sprite sheets)
Destroy object on collision
  1. Add the breakable object to the "breakable" group (from the Node tab next to Inspector)
  2. Add a script to the breaker object
  3. Connect the body_entered signal on the breaker object to its script
  4. Use this code instead of pass:    

    if body.is_in_group("breakable"):
            body.queue_free()

  5. In the Inspector for the breaker object, set Contacts Reported to 2 and Contact Monitor to On.
Play a sound
  1. Export the sound as .ogg file and put it in your Godot project folder
  2. Select the .ogg file in the FileSystem tab in Godot, and switch from Scene tab to Import tab
  3. Untick Loop, and click ReImport
  4. Switch back to Scene tab and add an AudioStreamPlayer2D node as a child of the node your script is on
  5. Drag the .ogg file as the Stream in the Inspector
  6. In your script, use this code to play the sound:

    $AudioStreamPlayer2D.play()