how might I be able to optimize this so I can make it
move a little then stop then move again, then stop.
Ay help is appreciated!
/* Moves target in memory, needs an AI */
if (huntmode == 1) {
/* Move the elk /
for ( i=0; i<MAX_ELK; ++i ) {
if ( elk[i].alive ) {
elk[i].x += elk[i].facingELK_SPEED;
if ( elk[i].x < 0 ) {
elk[i].x = 0;
elk[i].y += elk[i].image->h;
elk[i].facing = 1;
} else
if ( elk[i].x >=(screen->w-elk[i].image->w) ) {
elk[i].x =(screen->w-elk[i].image->w)-1;
elk[i].y += elk[i].image->h;
elk[i].facing = -1;
}
}
}
}
It moves it in memory, and I draw it later. But
it seems like if I touch this code even a little,
and I know I’m doing it wrong, the movement won’t
work anymore. thanks in advance…__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.