delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/29/23:38:37

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Tile Based Game, need help!
Date: Tue, 29 Apr 1997 21:13:57 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 27
Message-ID: <33666495.581F@cs.com>
References: <01bc5508$11470e60$LocalHost AT stachowiak>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp107.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Helix wrote:
> 
> I've been writing a tile based game but have unfortunatly come across the
> problem of character movement!
[snip]

This is pretty basic stuff here, but there are a number of ways to do
what you want.

1) Represent each tile as a structure, indicating not only the type of
tile but what "objects" are on it.
2) Maintain separate arrays, one for the tiles, and one for the
"objects" on the tiles.  The map display routine simply displays one
array and then the other on top of it.
3) Don't redraw the entire map each move; just redraw the tile your
character is on and the one it moves to.  This saves on time because the
map only needs to be drawn once.
4) More complex solutions not covered here.

Implementations of the above are left as an exercise for the reader.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |     mailto:fighteer AT cs DOT com     |
| Plan:  To find ANYONE willing to |   http://www.cs.com/fighteer   |
| play Descent 2 on DWANGO!        | Tagline: <this space for rent> |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019