by Fuzzy » Tue Jan 16, 2007 11:31 am
What about referencing an array that stores the contents of any location?
If you dont have a lot of critters or food on screen, it will be easier to make an array that points to each actor. perhaps not real pointers, but each actor could store his x and y there when it moves. If you use the actors old x and y, then you simulate synchronous movement, where no critter gets an advantage by moving first. in this case, use two arrays.
1. look in the old content array and decide what to do; move, eat, whatever.
2. move
3. store your actor.x and y in the current array
4. go to the next actor starting at step 1
4. after all the critters have moved, you copy the current array into the old array.
If you have a whole screen of critters, it may be simpler to use two arrays for every location on screen.
Mortal Enemy of IF....THEN(and Inspector Gadget)
Still ThreeFingerPete to tekdino