3. About enemy bullet shooting

I will explain the enemy bullet launching in this tutorial.

Enemy3 ‘s ArborFSM does not fire enemy bullet directly, but indirectly controls Weapon of child object.

Previous tutorial

From Ememy3 to fire command


Please look at the Shot state of Enemy3.

SendTrigger sends a trigger to Weapon, and the message is set to “ShotTrigger”.

On Weapon side, this “ShotTrigger” is triggered to control enemy bullet shooting.

For more information on SendTrigger, see Arbor reference “SendTrigger”.

Arbor Reference “SendTrigger”

Firing process by Weapon


Please select the Weapon object in the child of Enemy3 and look at the Arbor Editor.

The “ShotTrigger” message comes in when the TriggerTransition used for the Start state comes.

In the Stop resident state, it waits for the “StopTrigger” message, and when a message comes, it instantaneously transits to the Start state.

For more information on TriggerTransition, see Arbor reference “TriggerTransition”.

Arbor Reference “TriggerTransition”

In this way, by using SendTrigger and TriggerTransition, it becomes possible to create a mechanism to link objects.


LookAt2DObjectWithTag used in the Rotation resident state is the StateBehaviour this time created for 2D Shooting Game.

It is a script that turns the Transform specified in the Transform field to the object direction specified by Tag.

This time we are realizing our aim by bringing Weapon to the player direction.

About Shot state

In the Shot state, an EnemyBullet prefab is generated from ShotPosition1 and ShotPosition2 using InstantiateGameObject.

Then wait for 0.5 seconds with TimeTransition and continue to generate EnemyBullet repeatedly.

About EnemyBullet

In the EnemyBullet object, I move it using SetVelocityRigidbody2D.

Next Step

4. Create Weapon

Privacy Preference Center

Your Privacy

This site uses cookies to display contents and advertisements tailored to users, provide social media functions, measure advertisement impressions and clicks. We also gather information on users' site usage status and provide them to social media, advertisement distribution and data analysis partners. Each partner may use this information in combination with other information that the user provided to each partner or other information gathered when the user used the service of each partner.

Analytics, Ads