Tutorial: Script Course #1 – Let's Create a Shooting Attack

STEP 4: Fire the Bullet


1. Click the :scroll: icon next to Player to open the Visual Script.


2. Create a new Shoot state near Idle.

Set the animation to 044_Gun_Shoot.

:warning: 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 :play_button: or hit F5 to test play.
If the bullet fires and disappears upon hitting a tile, success!


:hammer_and_wrench: Troubleshooting


:cross_mark: The firing animation doesn’t play

Check if the transition from Idle → Shoot is configured correctly and that the animation is properly set.


:cross_mark: The character stays in the shooting animation forever

The return transition from Shoot → Idle might not be set correctly.


:cross_mark: 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

:cross_mark: Only one bullet can be fired

Bullet limit may not be set to unlimited in the BulletSettings.


:cross_mark: 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

:right_arrow: Continue to Part 2

「いいね!」 1