GameMaker Studio: Kirby’s Crash Ability

In the Kirby games, one of the most powerful copy abilities is the Crash ability. When used, it wipes all enemies on screen and does severe damage to bosses. Today presents a project that recreates one of Kirby’s copy abilities at the most basic level. This project will:

  •    Create a large nova object that spawns around the player
  • Allow the player to make the nova object by pressing a button
  • Only let the player make the nova when they have max health
  • Double the player’s health upon having 1000 coins
  • Have GUI elements on the screen
  • Enemies that take large damage from the attack
  • Have the current health of the enemies show when they take damage

Project file

Project source code

Basic Crash Ability

basic-crash-ability

Expanded Crash Ability

expanded-crash-ability

Finished Crash Ability

Finished Crash Ability.gif

GameMaker Studio: Player Attack in a 2D platformer

 

GameMaker-Studio-Logo

In 2D platformers, players should be able to take care of enemies with more than just jumping on them. Today I will show you a method for a player attack. It creates a projectile that flies in front and behind the player and damages foes it hits.

Sprites (This tutorial assumes your sprites are basic coloured squares and your game has functional platform collision and player/enemy movement )

spr_player 32×32

spr_attack 32×32

spr_enemy 32×32

Objects

obj_player

Create Event

canfire = true

Alarm 0 Event

canfire = true

Press A Key Event

if canfire = true

{
if (keyboard_check (vk_left) = false) && (keyboard_check (vk_right) = false)
{
action_create_object_motion (obj_attack, obj_player.x,obj_player.y,10,180)

action_create_object_motion (obj_attack, obj_player.x,obj_player.y,10,360)
}
if keyboard_check (vk_left)
{
action_create_object_motion (obj_attack, obj_player.x,obj_player.y,10,360)

action_create_object_motion (obj_attack, obj_player.x,obj_player.y,10,180)
}
if keyboard_check (vk_right)
{
action_create_object_motion (obj_attack, obj_player.x,obj_player.y,10,180)

action_create_object_motion (obj_attack, obj_player.x,obj_player.y,10,360)
}
canfire = false
alarm[0] = 0.5 * room_speed
}

obj_attack

Collision Event with obj_wall

instance_destroy()

Collision Event with obj_enemy

instance_destroy()

obj_enemy

Create Event

global.Ehp = 10
Ehurt = false

Alarm 0

Ehurt = false

Step Event

if Ehurt = true
{
image_alpha = 0.5
}
else
{
image_alpha = 1
}

if global.Ehp <=0
{
instance_destroy()
}

Collision Event with obj_attack

if !Ehurt
{
global.Ehp-=5
Ehurt = true
alarm[0] = 0.3 * room_speed
}

When done, the player’s attack should produce moving projectiles. These projectiles disappear when hitting walls, are not produced every time the player mashes the A key, do damage to foes when they are hit by them, enemies flash invincibility frames when hit by the attack and disappear if they take enough damage.

I hope this tutorial has helped you in your project’s development.