• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM Instance variable logic problem



Ok is very simple, I have an object with this in create event:
acc_y = -8;
and this in the step event:
if (acc_y < 12) { acc_y +0,25}
y = y + acc_y;
Now i thought that the istances of the object didn't share the internal variables. When I spawn one moster his speed will be like +5, but if i spawn another one while the first one is still in the room, their acc_y get add to the other so they start to fall faster than they should. Is there something i'm missing?


Not exactly sure what your trying to do but the statement has a comma ,25 Did you mean .25?
I think your logic is off but not exactly sure what your trying to do.

They shouldn't share instance variables.
The code is

acc = -8

if (acc < 12) {acc +.25} this is true so it will just add .25

y = y + - 7.75;

I dont think Y can have a decimal point?
Last edited:


They shouldn't share instance variables.
That's what i thought. I rewritten the code, this is why i used 0,25 and not 0.25. Anyway you have to understand that the acc decrease is in the step event, this means that every step the speed of the object will increase of 0.25
y = y - 7.75 | y = y - 7.50 | y = y - 7.25 | and so on. But if I have 2 instance of the same object they work like this:
With one instance of the object:
y = y - 7.75 | y = y - 7.50 |
When the other instance enter (or is spawn) in the same room:
y = y - 7.00 | y = y - 6.50 | y = y - 6.00 |
I'm telling you that the increase of the accelleration sum up from 2 different instances of the same object


I don't know...
step event:
acc_y += 0.25;
if (acc_y < 12)
{y += acc_y;}
Maybe set acc_Y to 0 instead of -8 in create event?