
-----------------------------------
MiX-MaztA-M8riX
Wed Oct 05, 2005 10:03 pm

RPG Mapping Help...
-----------------------------------
Im trying to make it so I have a tree drawn (50x50) on the map, and I need to have it so I cant walk into it or through it as I can pretty much do now. IF theres a simple way to doing this, it would be much appreciated instead of declaring stuff like

for treex :  10 .. 60
if x  = treex
then
die!
end if
end for

but yea, thx for the help in advance! :)

-----------------------------------
TokenHerbz
Thu Oct 06, 2005 12:07 am


-----------------------------------
Um, if you using say green trees you can use the whatdotcolor


whatdotcolor (x, y) = color


Thats probably the easiest way..

-----------------------------------
MiX-MaztA-M8riX
Thu Oct 06, 2005 5:50 am


-----------------------------------
that wont work because its a tile based game.. the grass is green too...

-----------------------------------
Tony
Thu Oct 06, 2005 7:59 am


-----------------------------------
if it's tile based already, why not just have a tile of the type "tree".

Keep in mind that tile's type, image, and size could be independent :wink:

-----------------------------------
ZeroPaladn
Thu Oct 06, 2005 9:06 am


-----------------------------------
what about jsut declaing certain coordinates (the trees of course) and putting simple collision detection, since whatdotcolor wont work.

-----------------------------------
TokenHerbz
Thu Oct 06, 2005 9:34 am


-----------------------------------
that might take a while..

I never used the tile mapping befor, i should tr it soon but...

cant you have a boolean for the tiles, and say the ones which are false you cant walk on/threw, and the ones which are true, you can??

How do you even creat a tile map??  its not with those numbers is it?  i still never figured that out :S

I use paint :)

-----------------------------------
Cervantes
Thu Oct 06, 2005 3:41 pm


-----------------------------------
cant you have a boolean for the tiles, and say the ones which are false you cant walk on/threw, and the ones which are true, you can??

How do you even creat a tile map??  its not with those numbers is it?  i still never figured that out :S

A two dimensional array stores many digits, which represent the type of tile.  
Limiting the 2D array to boolean means you can only have two types of surfaces.

-----------------------------------
TokenHerbz
Fri Oct 07, 2005 11:35 am


-----------------------------------
oh, so...

Then you will make numbers represent different things?
0=walk
1 = tree
2=grass???

Can you PM with a small expamle of this??  cause i dont see how you can acutally *draw* the map with actual *graphics*...

but if you can, then im really intreaged.

-----------------------------------
codemage
Fri Oct 07, 2005 12:18 pm


-----------------------------------
Then you will make numbers represent different things? 

You can do it that way.  If you do it like that, it'd be good practice to declare the numbers as constants so the numbers in the code don't become confusing.

-----------------------------------
TokenHerbz
Fri Oct 07, 2005 2:45 pm


-----------------------------------
i dont follow...

-----------------------------------
Cervantes
Fri Oct 07, 2005 3:00 pm


-----------------------------------
All he's saying is that you create a constant called "grass" and it has a value of 0.  You then create a constant called "tree" and it has a value of 1.
Now, say you're checking to see if you can walk into a space:

if player.pos + player.dir not= tree then

Things read easier, this way.

As for drawing: decide on a gridsize.  Then, draw a point at (x * gridSize, y * gridSize).  Remember you're (x,y) coordinate is also the location of that tile in your 2D array.

I believe I've got some code to work with and draw grids.  It's easy to use it as a basis for a grid system program, rather than creating your new grid system all from scratch.  Look for it in Turing Source.

Edit: Scratch that.  Looks like I forgot to back up my Turing programs when I switched my OS's around.  Sorry about that.  :oops:

-----------------------------------
TokenHerbz
Sat Oct 08, 2005 11:43 am


-----------------------------------
Np, but

The grid system way, can you actually draw pictures?? using this 2D array??

How big are the tiles??  10*10? less?

i seen a tut on making tetris, to draw its pieces they used numbers, i dont understand his tutoreal though...

-----------------------------------
Cervantes
Sat Oct 08, 2005 2:49 pm


-----------------------------------

The grid system way, can you actually draw pictures?? using this 2D array??

Yes.


How big are the tiles??  10*10? less?

They can be as big or small as you want them to be.  They don't have to be squares, either.


I found my files on an old HD of mine.  Look in Turing Source. :wink:

-----------------------------------
TokenHerbz
Sun Oct 09, 2005 4:27 pm


-----------------------------------
i asked for a tutorial on this kind of thing... and a walk threw one.. please make one for me, and the others carvantes?

-----------------------------------
Cervantes
Sun Oct 09, 2005 5:12 pm


-----------------------------------
I'm way too busy to make a nice tutorial.  Perhaps if you come on IRC ( afternet, channel is #compsci.ca ) I can less structuredly explain it to you.  Or maybe someone else who's online can. :wink:
