Difficulty - No "Assembly is better"
In our final level, we are using a lot of animations. Big sprites moving around. Lots of combined animations to step through. However, since there is no player input, we don't need to care too much about CPU usage, more just code size.
In reality, I was just curious what people thought of the two techniques I'm alternating between.
#1
char animstate, animtimer;
animtimer = 30;
for (i=0; i < 120; i++)
{
animtimer--;
if (!animtimer)
{ if (!animstate)
{ do stuffs(0)
animstate = 1;
}
else
{
do stuffs(1)
animstate = 0;
}
animtimer = 30;
}
do other stuffs
vsync();
}
#2
for (i=0; i < 120; i++)
{
if (!(i%60))
{
do stuffs(1)
}
else if (!(i%30))
{
do stuffs(0)
}
do other stuffs
vsync();
}
I really like #2, because its super fast to write, and doesn't require a whole lot of extra variables to keep track of. I have this feeling that (!(i%X)) generates nasty assembly code.