samedi 23 mai 2015

Java Complex Path Collision

I've been having trouble with collision in my randomly generated dungeon maze game. So basically, my game randomly generates rooms and pathways between them. However, the way I detect collision is by Rectangles:

public Rectangle getBounds(){
    return new Rectangle(x, y, w, h);
}

Since I use Rectangles to detect the collision, whenever I try to leave a room and go into a pathway, the room's collision rectangle prevents me from doing so. Dungeon Generation Me Me(blue box) attempting to going into a green pathway(but I can't because of the room's collision rectangle), red boxes are the rooms, blue outlines are the collision boxes.

Is there a way for me to fix this, or a better way to detect collision?




Aucun commentaire:

Enregistrer un commentaire