We will create some basic features for the Player, allowing the Player to run, dash, perform basic melee attacks, as well as Collision Checking for the Player.
Hitbox
You can easily customize the player’s hitbox in the parameter Player Hitbox Settings.
To see the visual of your player hitbox, turn on Debug mode (by default it should be button 9). You should see your player hitbox in a green box.
Collision Checking & Death
Create a common event called Player Collision with trigger Parallel, and assign it to any switch (let’s call it Player Collision switch).
Inside this common event, call a conditional branch checkCollide between the player and events with the notetag <enemyAttack>. If it returns true, call Increase/Decrease Character HP with the target as the player and HP Change as “-damage.”
Now, all you need to do is turn on the Player Collision switch at the start of the game or at any point when you want the player to be able to take damage.
With death, when the player’s HP reaches 0, the system will automatically trigger Game Over. If you want to customize how the player dies, for example, spinning three times and then collapsing, first enable the Disable Auto Game Over parameter, then create a conditional branch HP(player) <= 0 inside the common event Player Collision. Do whatever you want inside this condition.
In this common event, add conditional branch check for a button is pressed, space for example. When it return true, increase player speed then call script "dash(distance)". Change speed back when the dash is finished.
Melee Attack
In the common event Player Control, create a conditional branch check if player is equipping a weapon typed "Sword" and leftclick. If it returns true, call the command Swing Weapon using your weapon image.
You can check the type of weapon player is equipping using equippedWeaponType("Type name").
Next, Create Dynamic Event with notetags <magicAttack> <dmg: weapon> <hitbox: 1.5, 1.5> at the position “player front” so that this dynamic event hitbox spawns in front of the player. This hitbox should also only exist for 3 frames.
Because we're using <dmg: weapon>, it'll automatically use player's equipped main weapon as the source of traits, and Skill ID 1 for damage formula. You can also manually assign another Skill ID for it via trait Attack Skill.
When you become more skilled at eventing, you can create many different types of attacks, for example, ranged attacks, melee attacks with custom sprites instead of using Swing Weapon, just like in a professional game. All of these are explained in this list of videos.


