Where We Left Off
Iâm developing a game independently, and the game Iâve built with Bakin is also published on Freem. Iâd love for you to play it, but you can get a good idea of what the game is like from this video:
In the previous article (linked below) we implemented the playerâs sword-swing motion and the launch of the attack hitbox for an action game.
In this article, Iâll explain how to create a monster and implement the logic that deals damage to it when the playerâs attack hitbox collides with it.
Implementing Enemy Characters (Monsters) in Bakin
When making an action game in Bakin, enemy characters are just as important as the player.
Enemy characters are more interesting when they have personality, but for now letâs implement a monster using free assets available in Bakin.
On Cast Motions
If you selected âNormalâ for the initial asset amount when creating a Bakin project, some monsters are already registered as Casts in âDatabaseâ by default, as shown below.

However, these default monsters are designed for RPG use and are not well suited for action games. You can see why by clicking the âMovement Graphicâ and checking the âMotionâ section in the bottom-right of the preview.
Notice that the âMotionâ only has âwalkâ and âwait.â This âMotionâ field is extremely importantâespecially for action games.

In Bakin, casts can only perform actions that are registered in their âMotionâ list. In other words, if a motion isnât registered, it cannot be used in the game.
So if you tried to implement an enemyâs attack but the cast had no attack motion, youâd end up with an enemy that attacks without any animationâvery unnatural.
From a playerâs perspective, an enemy that attacks out of nowhere without any warning is the height of unfairness, and it would cause immense stress and frustration, as you can imagine.
While you could technically work around this with magic-style effects, itâs generally much better to have enemies animate their attacks before dealing damage.
Checking the other casts, youâll find that Bakinâs default casts with the most motions are those created for the player and their allies.
For example, the âHero Aâ cast from the âheroâ category used in the previous article to implement the sword-swing has a large variety of motionsâattack motions, hit-stagger motions, sleeping-in-bed motions, and many more.

The more varied a materialâs motions, the wider the range of things it can do in Bakin action gamesâkeep that in mind.
After hearing all this, you might think the default monster assets have too few motions and that human casts would be better for enemies. Donât worryâthe free DLC â3D Monster Pack Vol.1,â included with Bakin from the start, contains monsters with a wide variety of motions.
Creating the Enemy Character (Monster)
Letâs actually create the monster to use as the enemy character. First, go to âResourcesâ in Bakinâs master menu screen and select â3D Stamp,â then press the â+ Addâ button.

A screen appears to select the 3D stamp assets to add. Choose â3D Monster Pack Vol.1â from the âAdd Menu.â
If â3D Monster Pack Vol.1â doesnât appear in the list, restart Bakin and download it from âAsset Showcase.â
â3D Monster Pack Vol.1â contains a variety of monster assets with motions. For now, select the entire â3D Monstersâ folder and press âAdd and Finish.â
Ideally youâd add only the resources you need, but this amount wonât slow things down, so adding all monster assets is fine. Also, Bakin can strip unused assets when packaging the final game, so adding everything up front makes development easier.

When the resource addition completes successfully, an info dialog appearsâclick âOK.â

Next, go to âCastâ in âDatabaseâ and press â+ Addâ in the upper-left to add a new cast.

A screen to select the asset for the cast appears. Navigate to â3D Stampsâ under âDatabase/Resourcesâ â â3D Monstersâ folder and select âGoblin A.â Then click âAdd and Finish.â

A confirmation dialog appears saying Goblin A has been added, and it will also appear in the actual Cast list.


The enemy character with a variety of motions is now created. Next, letâs build the attack motion and attack hitbox launch for this monster.
Moving the Enemy Character (Monster) on the Map
Placing the Enemy on the Map
Letâs place the newly created enemy character on the game screen. The âGoblin Aâ cast we created can be found under the âEnemy Castâ tab on the right side of the Bakin screen.
Technically, whether a cast is an enemy or ally is set in the castâs âType Designationâ fieldânewly created casts default to âBothâ ally and enemy.

Go ahead and place âGoblin Aâ on the map. To place it, just select it and click on the map.

Press âTest Playâ and check it in the game. Since Goblin A has no behavior configured yet, it just stands there, but you can see it moving slightly because it has motions set up.

This is how you place enemy characters on the map and have them fight the player to build an action game. Now letâs create the enemy characterâs attack motion.
Creating the Enemyâs Attack Motion
First, change the settings for âGoblin Aâ in âDatabaseâ â âCast.â In the âBasicâ tabâs âCast Managementâ section, change âType Designationâ to âEnemy.â
This change means the cast will only appear under âEnemy Castâ when placing on the map, and it also lets the game distinguish between allies and enemies in subsequent settings.

Next, create the âGoblin Attackâ cast as the hitbox cast that Goblin uses when attacking. The creation method is the same as for the playerâs attack action in the previous article, so Iâll skip the details.
For this âGoblin Attack,â set the âType Designationâ to âEnemy.â

The âOtherâ settings are basically the same as the playerâs attack action, but set the âElapsed Timeâ in âEvent Disappear Conditionâ to a short value like â0.1â or â0.2.â
If this time is long, the enemyâs attack hitbox lingers, causing the player to take unreasonable damage more often.
Also, enable âDisappear on Ally Collisionâ and disable âDisappear on Enemy Collision.â This creates an attack that doesnât disappear when hitting an enemy cast but does disappear when hitting an ally cast.

The âCast Eventâ for âGoblin Attackâ is as follows. Unlike the player, this one only contains âAttack Soundâ and âAttack Hitbox.â
This is because normal casts are treated as âEvents,â so attack motions must be configured in the cast event of âGoblin Aâ itself.

As a prerequisite, the âEvent Startâ for attack hitbox casts should be set to âStart Automatically (Execute Once in Parallel).â The âGoblin Aâ cast event is built as follows.
It would be better to make this a bit more complex for future flexibility, but letâs prioritize getting something working first.

Remember to set the âEvent Startâ for casts like this to âStart Automatically (Repeat in Parallel).â
Without this condition, certain cast events running can freeze the playerâs movement and cause other problems.
The flow of the âGoblin Aâ cast event is as follows:
â Move toward the player (face the player direction) ⥠Check if the player is in contact with Goblin A â âĄ-1 If in contact, attack â âĄ-2 If not in contact, do nothing ⢠Stop action for 1 second
Explanation: â is needed because the âMovement Patternâ in the left âMovement Settingsâ is set to âDonât Move,â which means the goblin stays in place without it.
You might think that setting âMovement Patternâ to âApproachâ would make â ââWalk 2 tiles toward playerââunnecessary, but that doesnât work.
The left movement settings operate independently of cast events. If movement is controlled from those settings, spontaneous movement can interrupt an attack motion in progress, canceling it.
Therefore, for action-game enemy casts, the castâs movement settings should in principle always be set to âDonât Move.â
Of course, in a normal RPG casts donât change motions on the map, so using movement settings is fine, but for an action game itâs not recommended.
Next, ⥠checks whether the goblin and player are in contact before attackingâbut this approach has a latent problem.
Only attacking when actually touching means the goblin wonât attack even when the player is clearly within reachâwhich makes for a very weak, unnatural enemy.
Iâll explain how to handle that in a later article, so for now just understand that the current spec only attacks when contact occurs.
âĄ-1 is similar to the previous article, but now instead of the player it applies motion changes, a stop during the motion, and then the attack hitbox launch to the âEvent.â
The stop is needed for the same reason as beforeâwithout it the attack hitbox launches the moment the goblin begins the wind-up, making the attack feel very jarring.
So generally you need to debug and tune how long to wait after each monsterâs attack motion before launching the hitbox to avoid that jarring feel (it varies per monster).
The stop in ⢠is simply to prevent the enemy from acting continuously at high speed without any pauses, which would make the enemy far too strong. For a boss you could intentionally shorten this to enable rapid-fire attacks, but this goblin is a generic enemy so one-second intervals feel about right (once implemented youâll see that even one second is fairly fast).
Now try running âTest Playâ again. Goblin A, which previously just stood there, should now actively move toward and attack the player.

Just to be safe, check âOptionsâ â âShow Collisionâ â check âPlayer and Eventsâ to verify the attack hitbox appears when the goblin attacks.
The playerâs damage logic isnât implemented yet, so the goblin is just shadow-boxing, but you should now understand how to implement an enemy character.
Summary
In this article I explained how to implement an enemy character in Bakin and have it launch an attack motion and attack hitbox.
Combined with the previous article where the player can swing a sword, all thatâs left is to add damage processing to both the player and enemy to have a functional action game.
Next time Iâll explain how to implement damage processing for both the player and enemies, so check it out if youâre interested.
đ Series: RPG Maker Bakin: Game Development Guide (5/17)