Tiled Map, Collision detection

Hello.

I’m new to unity, but I made games using Java + libgdx ( game development framework ).
I wrote a bomberman clone and now I want to redo it as a unity project.
Can you tell me what’s the best way to “implement” the tiled map, that I used in my game, which is very similar to this:


I used a 2-dimensional array that contains Tile-Objects ( which have a boolean passable and a boolean destroyable and a type… ). What’s the best way todo this in unity?

Also I wrote my own collision detection in java and since it is tilebased I had a very efficient way of detecting the collision. For example, when the player wants to move up, I only check the collision with the the 3 tiles that are in front of the player ( the direction, the player wants to move, so I check collision for the top left, top, top right tile, outgoing from the tile the player is currently on, when you want to move up ).
Collision in unity works fine, however I don’t exactly know how the collision is done with the 2d rigidbodys ( it’s a 2d game btw. ) and to only check with the tiles, that the player can actually collide with would be the most efficient way I think.

Thanks in advance.

Jan

Do the same thing.

–Eric

1 Like

Thanks for the answer.
Will I be able to see my map in the editor’s scene and change things there?
Is it right to create a gameobject for the map and add the script for the tiled map?
The thing is, that I don’t want to design the map without visual assistance ( the scene view ), as I did when I was using java. Being a programmer I still have to learn where to put my the code and basically get used to the architecture of unity.

Ok so I think I know how to create my tile map. It seems the bigger problem is that I want to edit it in the scene, having a grid and being able to set certain properties for the tiles, guess I have to look for a unity tile addon or something, or create my own.

But what about the collision? Tilebased collision is very efficient, on my bomberman if I want to walk I just have to check the collision with the surrounding tiles ( actually even less, since the player doesn’t move in all directions ).
Can someone tell me how collision detection is handled internally? Like is it looking for a collision with every other gameobject, that’s not even in range? Just some information on this would be great.