0

i have a small function in a collision event in Game Maker, for some reason once triggered, the variable is supposed to increment, by another variable, it just runs off and keeps increment to max. here is the code.

if(global.rep <= 5000){
    global.rep +=  rep_gain;
    global.poop_time = poop_time - 5;
}

if this is in a collision event it should only fire once, the variable rep_gain is an irandom(5,10), but it will just keep running to 5000 which is max.

4

1 回答 1

1

在游戏制作器中,不断调用碰撞事件,直到通过使 2 个对象不再碰撞来解决碰撞。如果你不这样做,那么变量将增加直到最大值。

于 2015-01-22T02:35:21.257 回答