Hi guys,
I'm creating a maze but am having issues with the walls. What I've done is set a world background with an image of a maze. Then I made a copy of that maze image and clipped out (using photo editing software) the path so that I could make an actor out of that clipped out image. I created an actor (MazeWalls1) for the clipped out image and used addObject to overlay it on top of the world background. Prior to using collision code, the player will walk underneath the wall actor. However, when I use the getOneIntersectingObject code, it is acting as if the player actor is touching the MazeWalls1 actor no matter where the player moves. Instead, will I need to crop out a piece of the wall and use addObject to place the walls (like 50 placements) in the world class?
Here is the code for the World class:
Here is the code to check collision:
private void prepare(){ Player player = new Player(mazeSong); addObject(player, 200, 300); Dragon dragon = new Dragon(); addObject(dragon, 500, 200); MazeWalls1 walls1 = new MazeWalls1(); addObject(walls1, 358, 303); }
public void collision(){ MazeWalls1 walls = (MazeWalls1) getOneIntersectingObject(MazeWalls1.class); if (walls != null) { getWorld().removeObject(this); } }