[A83] Re: Monsters in smoothscroll game


[Prev][Next][Index][Thread]

[A83] Re: Monsters in smoothscroll game




Everything depends on what you want to do. If you plan your=20
program carefully, you can save yourself a lot of effort=20
later.

Personally, I prefer handling the terrain and the monsters=20
separately. (It is not closely related to the question, but=20
I prefer keeping a separate screen for the background, and=20
use another screen where I combine it with the monsters,=20
and which will be actually displayed.) If you have a=20
tilemap routine, you must be able to tell what kind of tile=20
you are on given its coordinates. You should use a=20
coordinate system for the monsters that can be easily=20
transformed into tilemap coordinates, e. g. by simple=20
shifting.

The player should be in the same coordinate space as the=20
monsters. For example, in Death Rally I use 24 bits for the=20
coordinates. The upper 8 bits identify the tile, the next 4=20
bits identify the pixel position within the tile (I use=20
16x16 tiles) and the remaining 12 bits are only used for=20
the internal calculations. This way I can easily decide=20
what kind of terrain a certain object occupies by simply=20
reading the upper byte of its coordinates.

>From all the above you can determine which tiles a monster=20
is interacting with, so you can decide about what actions=20
to take. If you pick coordinate systems in a clever way,=20
you can easily detect monster vs. terrain collisions.=20
(Monster vs. monster interaction should be trivial.)

The fact whether you need to keep updating the coordinates=20
of distant foes heavily depends on what kind of game you=20
are working on. In a game like Penguins or Sqrxz it is more=20
practical to create enemies which are really close (from=20
outside) to the edge of the screen. If they are farther, it=20
should be enough to record whether they are alive or not=20
(if I remember well, the enemies in Penguins just keep=20
respawning if you move back and forth at a place where they=20
are generated, so even their status is not recorded). On=20
the other hand, there might be special enemies whose=20
location might be always important. Another example would=20
be a real time strategy game (probably not a realistic one=20
regarding the 83's capabilities...), where you really must=20
track the movements of every single unit.

However, I still believe that the most helpful answer would=20
be: "think about how YOU would do it"...

PG

Ps. how did you manage to write the word "co=F6rdinate"? (if=20
you didn't do it consciously) I once saw it in a newspaper=20
article, and I couldn't imagine how it could get there...





Follow-Ups: References: