GameMaker Studio: Kirby’s Tornado Ability

KCC_Tornado_2

In the Kirby Games, the Tornado ability severed as a ability for combat and level navigation. When used, the player is temporarily invulnerable and enemies take damage from Kirby’s touch. Holding down the jump button also made Kirby rise into the air. Today presents a project recreating Kirby’s Tornado ability at the most basic level. This project will:

  • Have GUI Elements on the screen
  • Enemies that take damage by jumping on top of them or from using Tornado
  • Have the current health of the enemies show when they take damage
  • Basic platforming with an ability that can be used when touching the ground

Project file (Press Download All and run the project in Gamemaker Studio)

Project source code

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.