• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Other checkpoints disappear when I collide with specific one

A

Agletsio

Guest
When I touch obj_checkpoint it is set to change its sprite when it's activated (collide with player). But when the checkpoint I collided with changes its sprite, the other checkpoints disappear.

The reasoning behind this code I got from this video by Shaun Spalding.

I'm not sure what the problem is? I feel like I might not be indicating what should happen to other checkpoint instances when I collide with specific one? I'm not very experienced with coding yet so I apologize if this is a silly question.

Any help would seriously be appreciated! This is for a game jam that ends in four days!


These are my global room variables, which I initialize in a separate room at beginning of game:

Code:
global.checkpoint = noone;
global.checkpointR = 0;
global.checkpointx = 0;
global.checkpointy = 0;

room_goto_next();


Here's the code in obj_checkpoint step event:

Code:
if (place_meeting(x,y,Ninja)) {

global.checkpoint = id;
global.checkpointR = TrueLevel;
global.checkpointx = x;
global.checkpointy = y;

}

if global.checkpointR = TrueLevel
{
   if (global.checkpoint == id) 
      {
       sprite_index = spike_fall;
      }


else

sprite_index = obj_checkpoint;

}
 
Top