• 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!

Legacy GM Pass an argument to an alarm?

D

Dibidoolandas

Guest
I'm working on a platformer, and I have an alarm on my bounce springs that tells them to shut off the "bounce" effect after a very short time so the player doesn't bounce to the moon (springvcollide.alarm[0] = room_speed/6;)

However, I now want to extend this to other movable objects like enemies, in case they land on the springs. Right now, the spring turns off the bounce effect by saying, "obj_player.bounce = false;" but really it should be [obj_that_bounced.bounce = false;]. Is there a way I can set the alarm and pass it an argument for what object id jumped on it? Thanks in advance.
 

TheouAegis

Member
Why don't you use the alarm of the object that collided with it? I mean, think about it. It's not the spring itself that is on a timer, it's anything that collides with it. And if the player collides with the spring and then an enemy collides with the spring immediately afterwards, your code wouldn't work because the spring is already being occupied by the player. So if you use the player's alarm and the enemy's alarm rather than the Spring's alarm, then they can all work together.
 
D

Dibidoolandas

Guest
That's a good point that the alarm would get jumbled between the two interactions... I guess part of what I'm doing now is trying to optimize, so I'm trying to duplicate as little code as possible - This way I'll have to back a 'bounce' timer into each object that can possibly bounce, but I guess that's the best way to do it. Thanks for the insight, I'll take a crack at it.
 
Top