Skip to content
Forum Archive

Loops

4 posts

djcoolman#

Loops

loop(c+1);
I know i can do it like this:
c=if(equal(b,1),c+1,c)
But i think that functions is a shorter way.
And i need frame var.
Like this
c=every(frame,20,do(c+1))
Jaheckelsafar#
You coulb make a var to count the frames, the base something on the modulus (sp?) (% operator) of that.
Rovastar#
I am no expert on this but

c=if(equal(b,1),c+1,c)

can be inproved by writing it as

c=if(b,c+1,c)

Thus saving a equal condition for every repeation.

The % operator is a useful tool but remember that this operator is one of the greatest drains on performace so use it wisely.
Rovastar#
Or even better than:

c=if(b,c+1,c)

Would be just

c = c + b

(I think 🙂 ) Thus getting rid of all those nasty "if"'s and "equal"'s.