STEP 3: Set the Bullet and Gun for the Player
1. Go back to the Object_Sampleplayer
tab.
2. Click the Add Node button at the top-left of the Scene panel.
3. From Node > AGMaker
, add a BulletSettings node.
This node manages the bullet to be fired.
4. Expand BulletDataList > + Add Bullet > <empty> > NewBulletData
to create new bullet data.
5. Configure the basic bullet settings in Bullet Base Settings
:
- Name: Set any name (e.g.,
Sample_Bullet
)
- Object Path: Select the
sample_bullet.tscn
you created earlier.
If you move this file later, the reference will break.
- Unlimited Bullets: Enable this option
(Details explained later.)
6. Set the Initial Behavior to FireObjectDirection
, which fires the bullet in the direction the object is facing.
7. The bullet setup is now complete!
You can now fire sample_bullet
in the direction the player is facing using the fire action.
8. Let’s attach a gun to the player.
Select AnimationPlayer
, and try playing the animation 044_Gun_Aim
.
The aiming animation plays, but the player still appears unarmed.
9. The gun image is included by default.
Navigate to templates > objects > weapons > P_other
in the FileSystem.
Use W_005_gun.png
. It fits well in the character’s left hand.
10. In the Scene panel, select:
BoneAnimationRoot2D > Skeleton > B_Chest > B_Joint_L > B_Arm_L > B_Hand_L > B_Weapon_L
11. With B_Weapon_L
selected, drag and hold Shift while dropping W_005_gun.png
near the hand.
This adds the image as a child node of B_Weapon_L
.
12. If you did it correctly, W005Gun
should be a child of B_Weapon_L
.
If not, move it manually under the correct node.
13. Adjust the angle and position.
Select W005Gun
and go to Node2D > Transform
in the Inspector.
Set:
- Position: x: 12, y: 21
- Rotation: 156.4 degrees
Even if the rotation is 0, the bone may already be rotated due to the animation, affecting the child.
14. Play the animation to make sure the gun looks correct while moving.
If everything looks good, let’s now adjust the gunfire origin.
15. Use a Connector node to specify the bullet firing point.
Although the character has a node called Connector - gun fire
, it appears near the feet.
Move it to the muzzle of the gun.
Now your player has a bullet, a gun, and a correct firing point!
Bullet Settings Explained
Basic Settings
- Shot Count: Number of bullets fired per action.
Can be used for burst fire or shotgun effects.
If the state changes mid-shot, firing stops.
- Fire Interval: Interval between each bullet in multi-shot.
- 0.3 sec = fire one bullet every 0.3 sec
- 0 sec = fire all bullets simultaneously
- Shot Limit: Maximum number of bullets on screen.
- If 1, you must wait for the previous bullet to disappear.
Initial Behavior
- Initial Behavior: How the bullet moves after being fired.
If the bullet’s script controls movement, that takes priority.
- Spread Range: Degree of spread.
- Spread Type:
Fixed
: evenly spaced within spread angle
Wiper
: swings back and forth while firing
Random
: random angles within spread range
In-flight Behavior
Controls behavior after launch.
Examples:
- Homing on locked targets
- Boomerang-like arcs
Again, bullet’s own script has priority over these settings.