STEP 2: Create the Bullet Object - Bullet Script
-
Create a new script. Click the
icon at the top of the Scene window to create a new script.

-
Ensure the language is set to VisualScript, then give it any name and create it.
-
Rename the first node to “Move” and enable the option to ignore gravity.
-
From Actions > +Add Executable Action, add an attack configuration as an executable action. Specify the hit group to be “Enemy” only. This prevents the attack from hitting the player.
-
Next, add a new state via Add State and name it “Remove”. Also enable the option to ignore gravity for this state.
-
Add the executable action “RemoveSelf” to the Remove state. This process removes the object itself from the game. Objects like bullets and enemies must be removed after they have fulfilled their role; otherwise, they will persist indefinitely and consume resources, so be sure to remove them.
-
Finally, right-click “Move” to create a link and connect it to “Remove”.
-
Set three removal conditions. The first is when hitting an enemy. From the Inspector, go to Conditions > Add Condition and add “ContactWithHitArea”. Since you want to detect contact from any direction, set the detection direction to “All” and the target group to “Enemy”.
-
Set the second condition. Follow the same procedure to add “Offscreen”. Set the target type to this node, and set the logical condition with the previous condition to OR. If this remains AND, the transition will not occur unless both conditions are met.
-
Set the third condition. Follow the same procedure to add “ContactWithTile”. Since you want to detect contact from any direction, set the detection direction to “All”. Set the logical condition with the previous condition to OR.
-
Now, the object will be deleted when it hits the enemy group OR goes off-screen OR contacts a tile.
TIPS
Actions: Remove vs. RestoreRemove, Disable vs. Enable
You may have noticed similar conditions; here is an explanation of how to distinguish between them.
“Remove” completely deletes the object from the game, making it suitable for objects that do not need to be reused. While “RestoreRemove” can bring it back, it actually re-generates the object, resetting its previous state.
“Disable” only temporarily stops the object from functioning without removing it from the game. Therefore, using “Enable” allows it to return to its original state exactly as it was. This is convenient, but objects in the “Disable” state still consume resources, so it is safer to “Remove” objects that have no intention of being reused.
Configuring a Disappearance Animation
In this case, no animation was set, so the object disappears immediately. However, if you set an animation on the “Remove” action, it will disappear before the animation plays.
If you wish to set one, it is recommended to add a “Hit” state between “Remove” and “Move”.
When the hit condition is met, transition to the “Hit” state to play the animation. Then, transition to the “Remove” state when the condition “Animation Finished” or “Time Elapsed” is met.









