This extension can be used to fire projectiles from an object. It provides advanced functionality including:
- Cooldown between shots
- Ammo management
- Multi-fire bullet patterns
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.
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
CursorY can be used as target.
Conviction of Gun Dude
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
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
Fire like a shotgun
Some randomness can be defined with these 2 properties:
- Angle variance
- Bullet speed variance