[A83] Re: Monsters in smoothscroll game
[Prev][Next][Index][Thread]
[A83] Re: Monsters in smoothscroll game
> Hi,
>
> I have a general in smooth scrolling games. Don't understand me wrong
> becausemost guys here seems to have smoothscrollingphobia, I do not want
to
> ask about smooth scrolling because I understand that. Though I have
problems
> understanding a certain technique that is used in smoothscrolling games,
and
> that is the movement of the enemies, f.e. in SQRZ. I checked the code
though
> I do nto understand how they do it.
> In such a game do you check whenever a new tilerow or column comes in if
> there is a new enemy on that tile and then draw it? Or give it a
coordinate
> on screen? Or do the monster have a mapcoördinate, that is updated every
> loop. SO even mosnters ofscreen get coordinate updates, can someone who
has
> experience with this please help?
It all really depends on how you want to do it. The two most obvious ways
would be to either update the coordinates of EVERY enemy in the entire level
(in which case the offscreen enemies' coordinates would change) or to update
ONLY the enemies that are currently onscreen. If you were to only update
the enemies that are onscreen, the game would be faster, but enemy AI could
never take the enemy offscreen =P If you were to update every single enemy,
then the game would definetly be slower.
Another method is to update the coordinates of the enemies that are onscreen
AND the ones that are a couple columns ahead/behind/above/below. That would
give the game a more 'natural' feel, since enemies could wander on and
offscreen.
BTW - A problem arises if you have multiple direction scrolling. In Mario
83, the enemies are stored in a one-dimensional array with each element of
the array being a column of the level (which is why you cannot place more
than one enemy in a column). As you go through the level, the enemies that
are a couple columns offscreen become animated and are added to the enemy
table. If you were to store the enemies this way, however, you could ONLY
have one-directional scrolling because when the enemies got offscreen you
would need to save them to the 'inactive' enemy array again, and if there
are two or more enemies in one column, one would write over the other =P
This problem can't be solved with a two-dimensional array, either - the
enemies could occupy the exact same row and column. You'd have to figure
out another way to do it.
P.S. Do you need smooth scrolling routines? I wrote some a while ago and
never did anything with them =P
- - Joe
joe@joepnet.com
Follow-Ups:
References: