delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/27/12:06:45

From: "Stefan Viljoen" <Stefan_Viljoen AT excite DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Blitting & Sprites
Date: Sat, 27 Jan 2001 07:25:43 +0200
Organization: The South African Internet Exchange
Lines: 39
Message-ID: <94uuri$kok$2@ctb-nnrp2.saix.net>
References: <t72tlvcnn1ce6c AT corp DOT supernews DOT co DOT uk>
NNTP-Posting-Host: pc53-01-p120.nt.saix.net
X-Trace: ctb-nnrp2.saix.net 980614834 21268 155.239.176.120 (27 Jan 2001 17:00:34 GMT)
X-Complaints-To: abuse AT saix DOT net
NNTP-Posting-Date: 27 Jan 2001 17:00:34 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jimbo <rpgfreak AT lineone DOT net> wrote in message
news:t72tlvcnn1ce6c AT corp DOT supernews DOT co DOT uk...
> Hi,
>
> I am writing a game in DJGPP with Allegro and I was wondering if, within
all
> the sprite functions that are there, there are any that allow you to move
> sprites around that don't actually print themselves onto the background
> (i.e. the background is replaced). I know that I could do this using
> blitting, but isn't there an easier way? Isn't blitting slow? And what are
> the differences between sprite objects and bitmap objects?
>
> Regards,
> Jamie Solomons

You can download the "spec" file on my programming page
(http://home.intekom.com/rylan/prog.html ) or look here.

What is happening is that the sprites you are trying to animate destroy
their background (obviously!) What you need to do, or rather what I found
the easiest to do, is to keep a copy of the background you are overwriting -
and use a hidden page. Thus, draw on the hidden page, copy to screen, erase
the sprite in its old position on the hidden page (using the background page
that holds the background to do this) draw the sprite in its new position,
and copy that portion of the hidden page to the screen. This works
wonderfully using Allegro bitmaps and the blit operation.

Get the idea? Mail me if you have further trouble. This also stumped me a
while back, but I managed to solve it...!

Stefan Viljoen
F/EMS Dispatcher
Potchefstroom F/EMS
South Africa
http://home.intekom.com/rylan/



- Raw text -


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