Mail Archives: djgpp/1998/03/04/11:02:23
From: | Mr J P Havers <mavgv AT csv DOT warwick DOT ac DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Platform/Shooting Games with Tile-based tech...
|
Date: | Wed, 4 Mar 1998 14:47:51 +0000
|
Organization: | University of Warwick, UK
|
Message-ID: | <Pine.SOL.3.95.980304142941.23893B-100000@lupin>
|
References: | <34f69168 DOT 1072766 AT news DOT hknet DOT com>
|
NNTP-Posting-Host: | lupin-fddi.csv.warwick.ac.uk
|
Mime-Version: | 1.0
|
In-Reply-To: | <34f69168.1072766@news.hknet.com>
|
Lines: | 38
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
On Fri, 27 Feb 1998, VinN wrote:
> Hi,
> I read a lot of tile-based programming & I can write a side
> scrolling program now. Only can using arrow keys to scroll...(using
> DJGPP & Allegro)
> But one thing I don't know how...? How can I check the player
> (just like Mario) with the tile-map co-ordinate ? Is the player stand
> on a block & player will fall down when there's nothing below it...?
> My tile-map graphics is 16 x 16, & the player is 32 x 32
> (bigger or smaller). I want to write a platform or shooting game but
> don't know how to check the tile-map attribute with the player's
> bounding area...!
I have a couple of suggestions for doing this, there are probably hundreds
of ways, but here are just 2.
I think the main thing to do is that for each pixel, the character falls
down between each frame, you should check, whether his feet have touched a
platform or not. If he has then set his vertical velocity to zero, and his
position to that of the platform, else make him fall faster.
1. The way I have always used, is to have tiles the character can stand
on, and tiles he can't. If the (characters foot coordinates)mod(foot
size)=0 or something, (to find if he has just fallen from one square to
another) I divide his foot coordinate by the size of the tiles, and see
whether he is on top of a standable tile or not.
2. Another way, I consider "cooler", is to have in your game certain
colours which the character can stand on. This way you check the
colour of the pixel, underneath the character, to decide whether he should
fall or not.
These are not the only ways of doing this, but they might be helpful, and
should be easy to implement.
James
- Raw text -