GMS 2 How to make a shrinking red zone (Battle royale type)

Hello, I'm a little new on this forum
I have recently moved from GM8 to GMS2

I want to know if there's a way to make a shrinking red zone and its safe zone which can hurt the player if its outside the safe zone,

can please someone help me?
 

TheouAegis

Member
If it's a circular zone like in PUBG, all you need is the center of the safe zone, the radius, some extraneous variables, and some form of timekeeping.
Code:
redzone_active = false;
redzone_minimum = 2048; //minimum radius of the safe zone
redzone_x = irandom(room_width - redzone_minimum) + redzone_minimum; //may want to use irandom_range instead, depends on your map
redzone_y = irandom(room_height - redzone_minimum) + redzone_minimum;
redzone_radius = 524288; //I just made this number up, it will depend on the size of your map
alarm[0] = 5 * room_speed * 60;
Alarm 0 event:
Code:
redzone_active = 1;
if redzone_radius = maximum(redzone_minimum, redzone_radius - 4056);
End Step event:
Code:
if redzone_active
with obj_Player {
    if distance_to_point(redzone_x, redzone_y) > redzone_radius
        hp--;
}
 
Hello, I'm a little new on this forum
I have recently moved from GM8 to GMS2

I want to know if there's a way to make a shrinking red zone and its safe zone which can hurt the player if its outside the safe zone,

can please someone help me?
Add me on Discord N_George#0733
 
Top