GameMaker Dodge the Barrels

Information about object: obj_player
Sprite: spr_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

count=200;//set a timing counter
alarm[0]=room_speed;//set spawn alarm
Alarm Event for alarm 0:
execute code:

instance_create(random(room_width),0,obj_barrel);//spawn a barrel
alarm[0]=count;// rest alarm with count value
count-=5;//decrease count
if count<5 count=5;//keep at 5

Step Event:
execute code:

//movement
if (keyboard_check(vk_left))  {x-=5;} 
if (keyboard_check(vk_right))  {x+=5;} 


if place_meeting(x,y,obj_barrel)// if collides with barrel
{
show_message("You Died");
game_restart();
}

Information about object: obj_barrel
Sprite: spr_barrel Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Create Event:
execute code:


motion_set(270,3);//move down at speed 3
Step Event:
execute code:

if y>room_height instance_destroy();//destroy when reached bottom of screen

No comments:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *