Author |
Message |
MiX-MaztA-M8riX
|
Posted: Wed Oct 05, 2005 10:03 pm Post subject: 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
code: |
for treex : 10 .. 60
if x = treex
then
die!
end if
end for
|
but yea, thx for the help in advance! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TokenHerbz
|
Posted: Thu Oct 06, 2005 12:07 am Post subject: (No subject) |
|
|
Um, if you using say green trees you can use the whatdotcolor
code: |
whatdotcolor (x, y) = color
|
Thats probably the easiest way.. |
|
|
|
|
|
MiX-MaztA-M8riX
|
Posted: Thu Oct 06, 2005 5:50 am Post subject: (No subject) |
|
|
that wont work because its a tile based game.. the grass is green too... |
|
|
|
|
|
Tony
|
Posted: Thu Oct 06, 2005 7:59 am Post subject: (No subject) |
|
|
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 |
|
|
|
|
|
ZeroPaladn
|
Posted: Thu Oct 06, 2005 9:06 am Post subject: (No subject) |
|
|
what about jsut declaing certain coordinates (the trees of course) and putting simple collision detection, since whatdotcolor wont work. |
|
|
|
|
|
TokenHerbz
|
Posted: Thu Oct 06, 2005 9:34 am Post subject: (No subject) |
|
|
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
|
Posted: Thu Oct 06, 2005 3:41 pm Post subject: (No subject) |
|
|
tokenherbz wrote: 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
|
Posted: Fri Oct 07, 2005 11:35 am Post subject: (No subject) |
|
|
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. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
codemage
|
Posted: Fri Oct 07, 2005 12:18 pm Post subject: (No subject) |
|
|
Quote: 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
|
Posted: Fri Oct 07, 2005 2:45 pm Post subject: (No subject) |
|
|
i dont follow... |
|
|
|
|
|
Cervantes
|
Posted: Fri Oct 07, 2005 3:00 pm Post subject: (No subject) |
|
|
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:
code: |
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. |
|
|
|
|
|
TokenHerbz
|
Posted: Sat Oct 08, 2005 11:43 am Post subject: (No subject) |
|
|
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
|
Posted: Sat Oct 08, 2005 2:49 pm Post subject: (No subject) |
|
|
tokenherbz wrote:
The grid system way, can you actually draw pictures?? using this 2D array??
Yes.
tokenherbz wrote:
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. |
|
|
|
|
|
TokenHerbz
|
Posted: Sun Oct 09, 2005 4:27 pm Post subject: (No subject) |
|
|
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
|
Posted: Sun Oct 09, 2005 5:12 pm Post subject: (No subject) |
|
|
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. |
|
|
|
|
|
|