Tile engine / 2-d mapping
Author |
Message |
DifinityRJ

|
Posted: Mon Jun 11, 2007 9:56 pm Post subject: Tile engine / 2-d mapping |
|
|
Ok, recently been trying to make a tiling engine, so far i can make the map in a text file load it in turing, read it, organize it, draw everything where it needs to be and then.... Well heres the problem :
- I want to make this into a game but games need collision especially this because i will be making a platform sort of game.
---> I know how to Pic.ScreenLoad and Pic.ScreenSave to make pictures out of them and then just load the pictures with Turing
and then use Whatdotcolor, but i don't want to use Whatdotcolor.
- So now i have to figure out how i am going to get the coordinates of the tiles, well each tile is 20 * 20, and i know the size of my
screen and how many tiles i will have so this is easy to figure out.
---> But now i got to figure out how to draw the tiles on the screen with their coordinates, and also move them around, since its a
sidescroller.
How would i put the coordinates in arrays? Or i don't even have to do that maybe, i don't know. Please someone help.
I attempted many ways to fix this, just led to a lot of failure. I read the 2-d mapping tutorial, but it doesn't explain what i have discussed in this post.
Edit : I attempted again and this time when im drawing my pictures I just did this
code: |
Pic.Draw(tiles(tilenumber),c*20+cx,b*20,picMerge)
|
and i can side scroll the tiles now, but how do i do collision with them now? I was thinking boxed collision would be pretty easy. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
CodeMonkey2000
|
Posted: Tue Jun 12, 2007 3:48 pm Post subject: RE:Tile engine / 2-d mapping |
|
|
Collision is really easy with a good tiles system, all one needs to check is the tile the player is occupying (which I assume you stored in an array). Then check if that tile is okay to be in or not. To check the current tile, take the player x&y and div (NOT /) by the dimensions of the tiles. (eg. check what the tile is at (playerX div tileSizeX,playerX div tileSizeX) ) |
|
|
|
|
 |
CodeMonkey2000
|
Posted: Tue Jun 12, 2007 3:57 pm Post subject: RE:Tile engine / 2-d mapping |
|
|
If the player coordinates are real, you will have to round them. |
|
|
|
|
 |
DifinityRJ

|
Posted: Tue Jun 12, 2007 4:22 pm Post subject: Re: Tile engine / 2-d mapping |
|
|
CodeMonkey2000 wrote:
Collision is really easy with a good tiles system, all one needs to check is the tile the player is occupying (which I assume you stored in an array). Then check if that tile is okay to be in or not. To check the current tile, take the player x&y and div (NOT /) by the dimensions of the tiles. (eg. check what the tile is at (playerX div tileSizeX,playerX div tileSizeX) )
Im not sure what your assuming, "all one needs to check is the tile the player is occupying", that doesn't make sense. I haven't stored anything in an array. If you look at my first post, it says i dont know how to store the tile positions in arrays. So im not sure why you would assume i had them in an array, unless that's not what you mean. |
|
|
|
|
 |
LaZ3R
|
Posted: Tue Jun 12, 2007 4:28 pm Post subject: RE:Tile engine / 2-d mapping |
|
|
What he's saying is that in a tiles system, all you need to do for your "collision detection" is to check whether or not the space wanting to be moved in is currently occupied or not.
You should store each tile into an array of boolean and if an object/character is on it, make that tile have a value of false, otherwise, the object or person can move into the tile freely.
If you aren't aware of how to use arrays, you should learn them quickly now, they are very simple to understand and learn. |
|
|
|
|
 |
|
|