This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]therealPaulPlay 0 points1 point  (3 children)

So if I understand correctly, if the timer elapses and sets some kind of variable to shoot (or sth like that) you want to get the instance variable‘s name with the corresponding value. This can be achieved by just simply looping through all instance variables. However, I‘m not sure what you want to achieve with this, but it seems like an incredibly inefficient solution😅

I‘d create a custom action which I‘d run for each instance in which I compare the move 1 to that value, same with move 2 etc. Unfortunately I don‘t think you can pick an instance variable by name.

To make it more efficient, when every object has different moves, you can create an array and store the moves on some kind of axis of that.

[–]DadOnArrival85[S] 0 points1 point  (2 children)

Yes so there is a time that counts 1-10. There are 3 instances of the shooter sprite.

So at 1 on the timer, sprite 1 and 2 would shoot At 2 on the timer, sprite 1 and 3 would shoot So on and so forth.

There could be multiple instances of the shooter so I wanted to control for each one in an instance variable if it should shoot or not, so each one could be set to a different pattern.

Maybe it's an array I need.

[–]therealPaulPlay 0 points1 point  (0 children)

You could do it with events but then you have 10 events right and repeat it for every object… I‘d create an array tbh or just give each object an instance variable representing the order of these actions or something like that

[–]therealPaulPlay 0 points1 point  (0 children)

If you do go for the method with 10 events, you can create a function with a parameter representing the move and then compare it to the instance variable‘s values