COLLISION DETECTION HELP...
I am making a side scrolling platform game similar to Mario. I am using a generic tile-based map system with scrolling capabilities.
example
for(int x, x < NUM_XTILES; x++)
{
for(int y, y < NUM_YTILES; y++)
{
tile = MAP[x,y];
draw tile
}
}
... something similar to that.
Anyways, i was just wondering how to detect for collision with the tiles. How did they do it in the old Mario games? Like, if the character hit a wall tile and needs to stop moving, how would I detect such a thing. Please help me with anything you have. (C source code would be nice!)
thanks
I''m guessing you have your own map editor that goes along with your actual game.
You should incorporate into your map editor the feature of editing the properties of each tile on the screen.
You edit for tile #45 (for example) that there should be collision from the right.
Then in your game you game_engine->GetBlockProperties(int Block_x,int Block_y);
That''s what your supposed to do anyway
The road to success is always under construction
You should incorporate into your map editor the feature of editing the properties of each tile on the screen.
You edit for tile #45 (for example) that there should be collision from the right.
Then in your game you game_engine->GetBlockProperties(int Block_x,int Block_y);
That''s what your supposed to do anyway
The road to success is always under construction
Goblineye EntertainmentThe road to success is always under construction
Just compare your character rect with the wall, ceiling, whatevers rect. nothing spectacular, 4 ifs
if (character.right > wall.left)
but think logically, obviously you wont have to check if the character is less than the ceilings top, all you wanna check for is the ceilings bottom, etc.
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
if (character.right > wall.left)
but think logically, obviously you wont have to check if the character is less than the ceilings top, all you wanna check for is the ceilings bottom, etc.
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
YA, USE BOUNDING BOX COLLISION DETECTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
JoeMont001@aol.com www.polarisoft.n3.net
JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement