My person can walk and hit a rectangular wall realistically, but when I make the wall circular or odd-shaped, the character hits the empty space of the symbol. Here's an example file: http://i219.photobucket.com/albums/cc37/
sebby_man/Testfilecollisions.swf
The code on the character is:
onClipEvent(enterFrame){
function move(xmove,ymove){
_x+=xmove;
_y+=ymove;
if(hitTest(_root.wall)){
if(xmove>0){
_x-=getBounds(_root).xMax-_root.wall.get Bounds(_root).xMin+0.1;
}
if(xmove<0){
_x-=getBounds(_root).xMin-_root.wall.get Bounds(_root).xMax-0.1;
}
if(ymove>0){
_y-=getBounds(_root).yMax-_root.wall.get Bounds(_root).yMin+0.1;
}
if(ymove<0){
_y-=getBounds(_root).yMin-_root.wall.get Bounds(_root).yMax-0.1;
}
};
if(hitTest(_root.circle)){
if(xmove>0){
_x-=getBounds(_root).xMax-_root.circle.g etBounds(_root).xMin+0.1;
}
if(xmove<0){
_x-=getBounds(_root).xMin-_root.circle.g etBounds(_root).xMax-0.1;
}
if(ymove>0){
_y-=getBounds(_root).yMax-_root.circle.g etBounds(_root).yMin+0.1;
}
if(ymove<0){
_y-=getBounds(_root).yMin-_root.circle.g etBounds(_root).yMax-0.1;
}
}
}
if(Key.isDown(Key.LEFT)){
move(-5,0);
}
if(Key.isDown(Key.RIGHT)){
move(5,0);
}
if(Key.isDown(Key.UP)){
move(0,-5);
}
if(Key.isDown(Key.DOWN)){
move(0,5);
}
}
Note, this code is based off of Tela_Ferrum in his Collisions - Move to Contact post.
But I need this code to register when pixels are touching and not only when the rectangles around the movieclips are touching.
So how can I format my code so that the collision detection is more accurate, enough to allow the character to touch the circle or odd-shape itself and not just the empty space?