Game Development with Bakin
I recently decided to challenge myself and started making an action game with Bakin. Iâve put together something that moves at a basic level, so I recorded a video.
It only has the minimum action elements implemented so far, but this is the kind of action game Iâm aiming for.
As I continue developing, I decided to write articles so I donât forget why I implemented each action the way I did, and hopefully so others can use them as a reference for their own game-making.
If you want to know why I started developing games, or what Bakin even is, please read this article first.
Also, the initial game settings and player creation were completed in the previous article, so if you havenât done that yet, please check that article first and create your initial game state.
Implementing the Playerâs Sword Attack Action
The foundation of any action game is the playerâs (protagonistâs) action repertoire.
Concretely, this includes walking, running, jumping, close-range attacks such as sword swings, ranged attacks such as bows, using magic, and any other game-specific actions.
Basic actions like walking, running, and jumping are supported by Bakin out of the box, so you donât need to worry about them. However, actions like swinging a sword must be implemented individually by the developer.
This article explains how to implement the sword-swing action that forms the core of an action game. Keep in mind this is just my way of doing itâthere are other approaches, and future Bakin updates may change whatâs needed.
Rather than memorizing the steps, try to understand the underlying thinking behind the implementation.
Creating a Cast for the Melee Attack Action
First, create a âCastâ to use as the âMelee Attack Action.â A âCastâ is a âcharacterâ that appears in the game worldâthe same word used for the actors in a stage play.
You might wonder why you need a âCastâ just to create an attack action. Honestly, itâs because thatâs how Bakin works.
In Bakin, the basic way to implement attacks in an action game is to use a transparent cast as a hitbox.
In other words, when the player performs the sword-swing motion, a transparent cast is launched, and when that transparent cast collides with an enemy, damage is applied. Thatâs the flow.
There may be easier approaches, but based on my research this seems to be the only wayâso keep this in mind for now (hopefully future updates will simplify things).
To create the Cast, select âDatabaseâ from the menu on the left side of Bakin.

In âDatabaseâ you can configure everything that appears in the game world.
For example, characters (âCastsâ), items that provide various effects, and skills usable in combat are all defined in âDatabase.â
This time Iâll build the playerâs attack actions using âCast,â so I created a new folder called âPlayer Actionsâ to store the actions I make.
Next, press the â+ Addâ button at the top of the âCastâ section.

A screen appears to select an image for the Cast, but leave it as âNoneâ and press âAdd and Finish.â

A new cast is added. Rename it âMelee Attack Actionâ and then adjust its settings. First, set the âType Designationâ in the âBasicâ tab on the right to âAlly.â

Next, open the âOtherâ tab and check âDoes Not Receive Damage,â âGenerated While Floating,â and âDoes Not Collide With Other Generated Eventsâ as a precaution (the cast will work without them). You must also set the âEvent Disappear Condition.â
Without this, the event will linger forever (though you can also remove it from within the event script). Generally, setting âEvent Disappear Conditionâ to âElapsed Timeâ with a short interval like â0.5â seconds is fine.
Itâs also a good idea to enable disappearance on âCollision with Enemyâ for now. Ideally youâd generate separate child casts (sword, spear, etc.) from âMelee Attack Action,â but since weâre using this cast directly for the attack, this setup works.

That covers the cast settings for now. Next, weâll create the Cast Event for this cast.
Creating the Cast Event for the Cast
To implement the sword-swing action, you need to set up the swing motion and the slash projectile inside the âMelee Attack Actionâ cast.
These configurations are done in whatâs called a âCast Event,â accessible via the âCast Event Settingsâ link under the cast name.

In âCast Eventâ you can configure âSheet List,â âConditions for Sheet Execution,â âElements That Change on Sheet Execution,â and âCommand Script Launched on Sheet Execution.â
âSheet Listâ and âConditions for Sheet Executionâ are used to switch between multiple events based on conditionsâfor example, a treasure chest has one event for the first time itâs opened and a different event for subsequent inspections.
âElements That Change on Sheet Executionâ lets you modify the castâs collision, movement, and graphics settings.
For this case, change the âCollision Settingsâ to uncheck âCollide with Player.â Finally, the main part of the cast event is the âCommand Script Launched on Sheet Execution.â This is complexâthe best way to learn it is by doing.
For this âCast Event,â the content needs to match the following image.

The âCommand Script Launched on Sheet Executionâ opens when you press the â+â button. Each script is categorized, and youâll generally find what you need by looking under âEventâ for event-related operations.
Itâs too much to explain everything, so please search for the scripts that correspond to the list shown above on your own.

Now let me explain the flow shown in the list. For âEvent Start,â use âStart Automatically (Execute Once)â this time.
Since this event will be triggered by a game-defined launch button, that setting is fine, but for other triggers a parallel execution mode is often better.
After that, the scripts flow as follows: Disable player input â Player swings sword â Sound effect plays â Launch slash â Re-enable player input.
The reason we disable player input first is that without it the player can move freely during the sword-swing animation.
Next, âChange Cast Motionâ sets the âattack_A_01â sword-swing motion for âHero A.â This motion is included with Bakin by default, so we can use it.

Then, âPlay Sound Effectâ plays the sword-swing sound. Use âSE_hit_Sword_01,â also included with Bakin by default.

The âWait 0.1 Secondsâ is included because without it, damage hits the enemy the instant the sword swings, which feels jarring.
Itâs not strictly required, but the appropriate wait time will need to be tuned individually for each weapon to avoid that jarring feel.
Small inconsistencies like this can cause noticeable stress for players, so aim for a polished, natural feel.
After that, moving the event one tile is what creates the range of the slashâthat one tile is the hitbox for the attack.
The range also needs to stay consistent with the weapon graphic. Too long or too short and players will notice. After the sword swing attack finishes, re-enable player input and switch back to the normal walk motion before ending.
The motion change might seem unnecessary, but Iâve added it as a precaution. This completes the cast event flow for the sword attack. Weâre almost done, but we still need to set up the trigger that calls this cast event.
Assigning the Cast to the Game-Defined Launch Button
To trigger the created âCast Event,â select âGame Definitionâ from Bakinâs master menu.

On the opened screen, select âRules and Controlsâ and scroll down in the second column to find âEvent Launch (Dynamic Generation).â Assign the cast you created to Launch Button 1.


Now pressing Launch Button 1 during the game will call the âMelee Attack Actionâ cast, which triggers its cast eventâexecuting the event we just created.
Testing in the Game
Letâs verify the sword-swing logic works correctly. Run âTest Playâ and press Launch Button 1 (default: âZâ key). If everything is correct, the player should swing the sword.

However, you may not be able to tell from the display alone whether the hitbox is what you intended. To check, go to âOptionsâ in the top bar during test play, select âShow Collision,â and check âPlayer and Events.â

The actual hitbox is now displayed as a red outline. The red-outlined square is the âMelee Attack Action,â so anything it touches will take damage.
Looking at it this way, you can confirm the implementation is working as intended. The âShow Collisionâ feature is invaluable in many situations going forwardâmake sure you remember it.
When your game isnât behaving as expected, the collision setup is very often the culprit.

Summary
In this article I explained how to implement the sword-swing motion in Bakin. At this point there are still no enemies, and damage logic hasnât been set up yet, so all the player can do is swing the sword.
In upcoming articles Iâll explain enemy implementation and damage processing, so check them out if youâre interested.
đ Series: RPG Maker Bakin: Game Development Guide (3/17)