Skip to content

Fire bullet

This extension can be used to fire projectiles from an object. It provides advanced functionality including:

  • Cooldown between shots
  • Ammo management
  • Reloading
  • Overheating
  • Multi-fire bullet patterns

Tip

Learn how to install new extensions by following a step-by-step guide.

Fire a bullet

The fire bullet behavior must be added to the object that shoots the bullets. One of the 2 fire bullet actions can then be used to actually fire bullets.

Bullets are usually created at the end of a cannon. Custom points of sprite objects can be used for this.

Fire in a given direction

Bullets can be shot in a direction given by an angle with the Fire bullet toward an angle action.

Space Shooter

Open in GDevelop

Fire to the cursor

Bullets can be shot to a position with the Fire bullet toward an position action. To shoot in the direction of the cursor, the cursor expressions CursorX and CursorY can be used as target.

Conviction of Gun Dude

Open in GDevelop

Fire several bullets at once

Fire parallel bullets

To fire bullets from 2 cannons, the Fire bullet toward an angle action can be added twice to the event. Once for each custom point.

Firing patterns example

Open in GDevelop

Fire spreading bullets

Firing bullets that spread on an arc could be done with the method from the previous section but these 2 properties make it a lot easier:

  • Number of bullets created at once
  • Firing arc

With these property values, the fire action fires 3 bullets evenly spread on a 10° cone.

Fire bullet example

Open in GDevelop

Fire like a shotgun

Some randomness can be defined with these 2 properties:

  • Angle variance
  • Bullet speed variance