Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Kirby Create Event:
- sucking = false
- carry = false
- fire = false //not used intutorial but explained as to why it's here
- Kirby Step Event:
- if (distance_to_object(obj_fire)<100) && sucking = true //sets how far you need to be from the enemy to suck it up
- {
- obj_fire.suck = true //sets enemies suck variable to true
- }
- if keyboard_check(vk_left) //just movement, if you have your own you can use that, just make sure to keep the "if carry" section
- {
- if carry = true
- {
- hspeed = -3
- sprite_index = spr_k_hold
- }
- else
- {
- hspeed = -3
- sprite_index = spr_k_walk_l
- image_speed = 0.5
- }
- }
- if keyboard_check(vk_right)
- {
- if carry = true
- {
- hspeed = 3
- sprite_index = spr_k_hold
- }
- else
- {
- hspeed = 3
- sprite_index = spr_k_walk_r
- image_speed = 0.5
- }
- }
- if keyboard_check(vk_nokey) //sets regular idle sprite
- {
- hspeed = 0
- sprite_index = spr_k_idle
- }
- if carry = true //sets idle hold animation for when Kirby has an enemy in his mouth
- {
- sprite_index = spr_k_hold
- }
- if keyboard_check_pressed(vk_down) //absorbs enemy
- {
- if carry = true
- {
- {
- instance_change(obj_kirby_fire,true)
- }
- }
- }
- Kriby Key Press Space Event:
- if speed = 0 //Checks to see if you're moving or not so that when you suck in enemies you can't cheat and move whilst doing so
- {
- sprite_index = spr_k_suck
- image_speed = 0.5
- sucking = true
- if image_index = 4
- {
- image_speed = 0
- }
- }
- Kirby Key Release Space:
- sucking = false //Turns off the sucking variable
- obj_fire.suck = false
- Fire enemy object (this same rules apply to any other enemies):
- suck = false //this variable makes it so that the game can tell when the enemy is being sucked
- Fire enemy Step Event:
- if suck = true
- {
- sprite_index = spr_fire_roll
- move_towards_point(obj_kirby.x,y,3)
- }
- else
- {
- speed = 0
- sprite_index = spr_fire
- }
- if place_meeting(x,y,obj_kirby)
- {
- if suck = true
- {
- obj_kirby.carry = true
- instance_destroy()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment