Move GHOST_SPAWN_DIRS and GHOST_SPAWN_POINTS
This commit is contained in:
		@ -1,5 +1,7 @@
 | 
				
			|||||||
package com.me.pacman;
 | 
					package com.me.pacman;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.me.pacman.entity.Direction;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public final class Constants {
 | 
					public final class Constants {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static final String TITLE = "Pac-Dude";
 | 
					    public static final String TITLE = "Pac-Dude";
 | 
				
			||||||
@ -29,4 +31,14 @@ public final class Constants {
 | 
				
			|||||||
    // and is close to the 75.75757625 pixels/second claimed in:
 | 
					    // and is close to the 75.75757625 pixels/second claimed in:
 | 
				
			||||||
    // https://pacman.holenet.info/#LvlSpecs
 | 
					    // https://pacman.holenet.info/#LvlSpecs
 | 
				
			||||||
    public static final float FULL_SPEED = 9.375f;
 | 
					    public static final float FULL_SPEED = 9.375f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Ghost spawn directions, should remain constant assuming they always exit the ghost house
 | 
				
			||||||
 | 
					    // from the top
 | 
				
			||||||
 | 
					    public static final Direction[] GHOST_SPAWN_DIRS = {
 | 
				
			||||||
 | 
					            Direction.LEFT, // Blinky
 | 
				
			||||||
 | 
					            Direction.UP,   // Pinky
 | 
				
			||||||
 | 
					            Direction.DOWN, // Inky
 | 
				
			||||||
 | 
					            Direction.DOWN, // Clyde
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,13 @@ import com.me.pacman.PacDude;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class Level {
 | 
					public class Level {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static final Vector2[] GHOST_SPAWN_POINTS = {
 | 
				
			||||||
 | 
					        new Vector2(14f, 19.5f),
 | 
				
			||||||
 | 
					        new Vector2(14f, 16.5f),
 | 
				
			||||||
 | 
					        new Vector2(12f, 16.5f),
 | 
				
			||||||
 | 
					        new Vector2(16f, 16.5f),
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private PacDude game;
 | 
					    private PacDude game;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private TextureRegion pellet;
 | 
					    private TextureRegion pellet;
 | 
				
			||||||
 | 
				
			|||||||
@ -22,20 +22,6 @@ import java.util.Random;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class PlayState extends LevelState {
 | 
					public class PlayState extends LevelState {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static final Vector2[] GHOST_SPAWN_POINTS = {
 | 
					 | 
				
			||||||
        new Vector2(14f, 19.5f),
 | 
					 | 
				
			||||||
        new Vector2(14f, 16.5f),
 | 
					 | 
				
			||||||
        new Vector2(12f, 16.5f),
 | 
					 | 
				
			||||||
        new Vector2(16f, 16.5f),
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static final Direction[] GHOST_SPAWN_DIRS = {
 | 
					 | 
				
			||||||
            Direction.LEFT,
 | 
					 | 
				
			||||||
            Direction.UP,
 | 
					 | 
				
			||||||
            Direction.DOWN,
 | 
					 | 
				
			||||||
            Direction.DOWN,
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private Texture levelBackground, winBackground;
 | 
					    private Texture levelBackground, winBackground;
 | 
				
			||||||
    private TextureRegion lifeSprite;
 | 
					    private TextureRegion lifeSprite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -129,17 +115,17 @@ public class PlayState extends LevelState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void spawnGhosts() {
 | 
					    private void spawnGhosts() {
 | 
				
			||||||
        ghosts = new Ghost[4];
 | 
					        ghosts = new Ghost[4];
 | 
				
			||||||
        ghosts[0] = new Blinky(this, new Vector2(GHOST_SPAWN_POINTS[0]), GHOST_SPAWN_DIRS[0]);
 | 
					        ghosts[0] = new Blinky(this, new Vector2(Level.GHOST_SPAWN_POINTS[0]), Constants.GHOST_SPAWN_DIRS[0]);
 | 
				
			||||||
        ghosts[1] = new Pinky(this, new Vector2(GHOST_SPAWN_POINTS[1]), GHOST_SPAWN_DIRS[1]);
 | 
					        ghosts[1] = new Pinky(this, new Vector2(Level.GHOST_SPAWN_POINTS[1]), Constants.GHOST_SPAWN_DIRS[1]);
 | 
				
			||||||
        ghosts[2] = new Inky(this, new Vector2(GHOST_SPAWN_POINTS[2]), GHOST_SPAWN_DIRS[2]);
 | 
					        ghosts[2] = new Inky(this, new Vector2(Level.GHOST_SPAWN_POINTS[2]), Constants.GHOST_SPAWN_DIRS[2]);
 | 
				
			||||||
        ghosts[3] = new Clyde(this, new Vector2(GHOST_SPAWN_POINTS[3]), GHOST_SPAWN_DIRS[3]);
 | 
					        ghosts[3] = new Clyde(this, new Vector2(Level.GHOST_SPAWN_POINTS[3]), Constants.GHOST_SPAWN_DIRS[3]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void resetGhosts() {
 | 
					    public void resetGhosts() {
 | 
				
			||||||
        for (int i = 0; i < 4; i++) {
 | 
					        for (int i = 0; i < 4; i++) {
 | 
				
			||||||
            if (ghosts[i] == null) continue;
 | 
					            if (ghosts[i] == null) continue;
 | 
				
			||||||
            ghosts[i].pos = new Vector2(GHOST_SPAWN_POINTS[i]);
 | 
					            ghosts[i].pos = new Vector2(Level.GHOST_SPAWN_POINTS[i]);
 | 
				
			||||||
            ghosts[i].currDirection = GHOST_SPAWN_DIRS[i];
 | 
					            ghosts[i].currDirection = Constants.GHOST_SPAWN_DIRS[i];
 | 
				
			||||||
            ghosts[i].currentPath = null;
 | 
					            ghosts[i].currentPath = null;
 | 
				
			||||||
            ghosts[i].caught = false;
 | 
					            ghosts[i].caught = false;
 | 
				
			||||||
            ghosts[i].inHouse = i > 0;
 | 
					            ghosts[i].inHouse = i > 0;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user