STEP 4: Fire the Bullet
1. Click the
icon next to Player to open the Visual Script.
2. Create a new Shoot state near Idle.
Set the animation to 044_Gun_Shoot.
If no animation appears, make sure the
Object_SamplePlayer
tab is open.
3. Add an executable action: Fire Bullet.
Set:
- Bullet Data to
Sample_Bullet
- Connector to
Connector - gun fire
This allows the player to fire Sample_Bullet
from the muzzle.
4. Link Idle → Shoot.
Set the condition to: while the X button is pressed (C key on keyboard).
5. Link Shoot → Idle (shortcut).
Set the condition to: when the animation finishes.
6. If everything is set up correctly, the player should now be able to shoot.
Press or hit F5 to test play.
If the bullet fires and disappears upon hitting a tile, success!
Troubleshooting
The firing animation doesn’t play
Check if the transition from Idle → Shoot is configured correctly and that the animation is properly set.
The character stays in the shooting animation forever
The return transition from Shoot → Idle might not be set correctly.
No bullets are fired
- Make sure the Fire Bullet action is properly configured.
- Confirm that:
- The bullet data is assigned
- The connector is set
- The connector is placed correctly at the gun muzzle
Only one bullet can be fired
Bullet limit may not be set to unlimited in the BulletSettings.
Bullets never disappear
Check the Visual Script of
sample_bullet
.
- Make sure:
- Remove state has the correct RemoveSelf action
- All 3 conditions are connected using OR, not AND