delorie.com/archives/browse.cgi | search |
Message-ID: | <36324EEB.B48CF1D@mail.bip.net> |
From: | Conan <Dr DOT Conan AT mail DOT bip DOT net> |
Organization: | Apocalypse Inc. |
X-Mailer: | Mozilla 4.01 [en] (Win95; I) |
MIME-Version: | 1.0 |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Level-map problem |
X-Priority: | 3 (Normal) |
References: | <70o6mb$lec$1 AT cubacola DOT tninet DOT se> |
Lines: | 47 |
NNTP-Posting-Host: | 130.244.237.27 |
X-Complaints-To: | news-abuse AT swip DOT net |
X-Trace: | nntpserver.swip.net 909266761 130.244.237.27 (Sun, 25 Oct 1998 00:06:01 MET DST) |
NNTP-Posting-Date: | Sun, 25 Oct 1998 00:06:01 MET DST |
X-Sender: | s-24416 AT dialup237-1-27 DOT swipnet DOT se |
Date: | Sun, 25 Oct 1998 00:04:27 +0200 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Leif Svensson wrote: > Hello! > I´m writing a 2d game and I got a problem that I think that maybe > someone > out there can help me with. > I´m having a problem with my map-system. > It should read in which tile who is where (There are 70 of them (10*7) > and > then refer to a object to keep the map-files small. How do I do this? > Do you got a better way to solve the whole map-file thing? > I don´t want any graphics in the file, cause the file will be too big > then. > Hope you understand what I mean. If not, Tell me.... > > Waiting for an answer from a kind soul.... > // Patrik , Sweden > > P.S: There´s over 450 tiles D.S Hi. I assume that what yore looking for is a funktion that translates pixelcoordiantes to tile coordinates. Meaning that if you hawe the coordinate you should be able to tell what tile youre on. If there is only 70 (7*10) then the formula would be: tileX=pixelX % tileWidth tileY=pixelY % tileHeight and then the tile is (tileY*10)+tileX this is werry slow. but if your tiles are 16,32 or 64 and so on... pixels wide then you could do it like this: tile=32^2 tileX=pixelX & 31 tileY=pixelY & 31 and then the tile is (tileY*10)+tileX Hope this helps... hope this is what you asked for!!! :) /Conan
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |