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

GameMaker [HELP]...[SOLVED]...if image_angle += 1 {global.totalSpinned += 1};

D

Devix167

Guest
Why does this not work? "unexpected unary operator +="...

What I'm trying to do is make a variable add 1 every degree spinned.

DnD and code is welcome to solving!
 

Perseus

Not Medusa
Forum Staff
Moderator
Use another variable that holds the last angle. If it's not equal to the current angle then calculate the absolute difference and add the value to the total counter variable. The setup should look something like this:

Code:
if (image_angle != last_angle) {
    var diff = abs(angle_difference(image_angle, last_angle));
    global.totalSpinned += diff;
    last_angle = image_angle;
}
 
Top