Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Storing enemy data

3 views
Skip to first unread message

Chris Rossall

unread,
Jan 11, 1996, 3:00:00 AM1/11/96
to
Hello I have a question about how to implement monsters in a 2d
tile-based game like gauntlet...Is it best to have the enemies stored as
tiles and when they appear on screen treat them as sprites or simply to
have a seperate list of all monster positions in a seperate data
structure?

-Chris


Sensarn

unread,
Jan 14, 1996, 3:00:00 AM1/14/96
to
How about both? Use a sprite structure to read/store information about
the sprite and a grid to keep track of the positions (unless positions
are all you want; in that case, don't add extra fields to the sprite
structure):

typdef struct sprite_typ
{
int x,y;
int state;
...
}

Steven Sensarn - txs5...@bayou.uh.edu

Rainer Deyke

unread,
Jan 15, 1996, 3:00:00 AM1/15/96
to
Chris Rossall (chris....@mailbox.swipnet.se) wrote:
: Hello I have a question about how to implement monsters in a 2d
: tile-based game like gauntlet...Is it best to have the enemies stored as
: tiles and when they appear on screen treat them as sprites or simply to
: have a seperate list of all monster positions in a seperate data
: structure?

Use a separate list. This makes it about a million times easier to move all
enemies.

--
+------------------------------------------------------+
| "Fumbling in frustration, inside soul torn apart |
| Feel the loss of paradise, leave an empty heart |
| Closing eyes will shut out, the warm light of a life |
| Grip is fading slowly, for each day passing by" |
| - Desultory, "A Closing Eye" |
+------------------------------------------------------+
| Rainer Deyke (rai...@mdddhd.fc.hp.com) |
+------------------------------------------------------+

Allen

unread,
Jan 16, 1996, 3:00:00 AM1/16/96
to
chris....@mailbox.swipnet.se (Chris Rossall) wrote:

>Hello I have a question about how to implement monsters in a 2d
>tile-based game like gauntlet...Is it best to have the enemies stored as
>tiles and when they appear on screen treat them as sprites or simply to
>have a seperate list of all monster positions in a seperate data
>structure?

>-Chris

It really depends on the density of the enemies. Just my personal
experience though I would recommend using a list of enemies. Possibly
even a two list structure where you keep enemies within a certain
range on the active list and enemies farther out in another.

Having a list structure for the enemies also allows you to avoid the
problem of having to search ALL the cells in your world every time you
go through a game loop and want to action all the enemies.

allen


0 new messages