Tile map collision

Hello everyone! I am making a tile based platformer game. The problem that I am running in is the collision detection of the player with the walls(unwalkable tiles) . Is there a better way of checking the collision without using the four corner points of the player? and as my game will have large levels so I will be needing an efficient algorithm for that, and sorry for my english ::slight_smile:

Normally the “four corner points” is the most efficient way to do this, is there any reason why this is not adequate for you?

What kind of movement system are you using? Are you using “Rogue-Like Movement” AKA you move Tile to Tile or are you using smooth normal movement?

If you are using Tile based movement then simply make it so that the application checks whether the tile next to it is a wall or not and if there isn’t a wall next to it then make it so the player can move there…

If you are using smooth normal movement then using the four corner points is more efficient if you are using rectangles that follow the player. Just place a rectangle on the four corners of the player object and if the rectangles are about to intersect another rectangle(let’s say the tile’s rectangle), then it cannot move that direction.

Well i don’t know but my four corner algorithm not working properly ( must be some problem at my end )
I actually followed actionscript 3 tutorials for file map collision and the major difference between it and java is that origin point in as3 is the center of sprite, whereas java engine i am using uses the left top corner as origin.

Is there any java based article or tutorial on it?
Oh and I am using it for smooth movement

BUMPPP , can anyone help me out please :frowning:

Some code to look at would certainly help this Thread :slight_smile:

Here(source in freebasic):

http://rel.phatcode.net/index.php?action=contents&item=Pyromax-Dax

Note that I don’t use a 4-cornered approach to collision. I use an axis-to-tile collision. The 4-cornered approach fails when your player dimension is bigger than the tile dimension. The approach I used will work on any sized sprite (be it larger or smaller the tilesize) an is quite fast.