Move function


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by Geoff Zelenka on April 17, 2001 at 18:08:11:

For figuring out how a critter is supposed to move on a tick is it allowed to do the following:

Keep an integer value that counts the number of ticks that happen, then do a mod function on the total number of ticks and the total number of possible moves for a critter and then use a switch statement

ie for a browser
int TotTicks;
int Move;

Move = TotTicks % 2;
switch(Move){
case 0:
//move critter east
case 1:
// move critter south
}

Is this okay?? Or do we have to use a data structure?
I feel this method is simpler and more effiecient.



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]