www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/30/16:48:46

From: rellwood <rellwood AT aludra DOT usc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Tile Based Game, need help!
Date: 30 Apr 1997 11:58:18 -0700
Organization: University of Southern California, Los Angeles, CA
Lines: 30
Sender: rellwood AT aludra DOT usc DOT edu
Message-ID: <Pine.SV4.3.94.970430114724.17180E-100000@aludra.usc.edu>
References: <01bc5508$11470e60$LocalHost AT stachowiak>
NNTP-Posting-Host: aludra.usc.edu
Mime-Version: 1.0
In-Reply-To: <01bc5508$11470e60$LocalHost@stachowiak>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 29 Apr 1997, Helix wrote:
> I set the game up so that it creates a random map in one procedure, and
> made a second procedure that
> receives arrow key input to move the character. The second procedure uses
> the map procedure to redraw the map once the character moves, so that the
> old copy of the character is draw over. The problem with this is that
> whenever I want the unit to leave a bitmap behind (like a city bitmap), (
> it's sort of like civilization) it's drawn over. Also when the character
> moves the hole map is randomized again since it calls the map procedure. 
> Alright what I really want is to be able to be able to move my character
> and the computer erases the previous bitmap, and only in some instances.

It sounds like you need to break your map procedure up into at least two
parts: one that generates the map and another that draws it to the
screen.  That way, you can call the map generator only once at the start
of the game, and call the drawing routine seperately whenever you need to
do so. 

As far as moving a a sprite (your character) without leaving a "hole",
what you can do is to store the part of the screen that the character will
be drawn onto into a buffer, then draw your character.  When the character
moves, simply slap down the stored buffer exactly where you picked it up,
on top of the character.  Finally, fill your buffer again with the new
area of the screen where your character is going to be moved to and draw
the character in this new spot.  Repeat as desired.

-Richard Ellwood

-- 

- Raw text -


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