STEP 4: Let’s Fire a Bullet.
- Click the
icon next to the Player to open the Visual Script.
- Create a new state named “Shoot” near “Idle” and set the animation to 044_Gun_Shoot. If no animation appears, please check that you have the Object_SamplePlayer tab open.
- Add an action to fire a bullet by setting the “FireBullet” action. Select “Sample_Bullet” as the bullet data and specify “Connector - gun fire” as the connection point. This will make the Sample_Bullet fire from the muzzle.
- Link from “Idle” to “Shoot”. Set the transition condition to “While the X button (C key on keyboard) is pressed”.
- Link from “Shoot” back to “Idle” as a shortcut. Set the transition condition to “When the animation finishes”.
- Now, if everything is set up correctly, you should be able to fire a bullet. Try a test play by pressing
or the F5 key. If the bullet is fired, hits a tile, and disappears, you have succeeded.
Troubleshooting if it doesn’t work
The firing animation does not play
It is likely that the transition is failing. Please check if the animation is properly set and if the transition settings from Idle to Shoot are correct.
Stuck in the firing animation
Similarly, the transition is likely failing. Check if the transition from Shoot back to Idle is set up correctly.
No bullet is fired
The bullet firing action might not be set up correctly.
Check if the bullet data is set correctly in the firing action.
Check if the connection points are set properly.
Check if the connection point is located at the muzzle position.
Can only fire one bullet
In BulletSettings, the number of visible bullets might not be set to unlimited.
Bullets do not disappear
Check the Visual Script of the sample_bullet object. Verify that a “Disappearance” action is set in “Remove” and that the three transition conditions are connected with OR.
Part 2 is here:




