public override void load() { lastState = GamePad.GetState(PlayerIndex.One); levelManager_ = new LevelManager(); directionsToDPad_ = new Dictionary<ACharacter.EOrientation, ButtonState>(); directionsToDPad_.Add(ACharacter.EOrientation.UP, ButtonState.Released); directionsToDPad_.Add(ACharacter.EOrientation.DOWN, ButtonState.Released); directionsToDPad_.Add(ACharacter.EOrientation.LEFT, ButtonState.Released); directionsToDPad_.Add(ACharacter.EOrientation.RIGHT, ButtonState.Released); hero_ = new Hero(spm_); monsters_ = new AEnnemy[] { new Blinky(spm_), new Inky(spm_), new Clyde(spm_), new Pinky(spm_) }; monsters_[0].setBlocked(false); }
internal ACharacter.EOrientation getPacManDirection(Hero h, ACharacter m) { int x = (int)((m.getX() - h.getX()) / 8); // POSITIF == LEFT NEGATIF == RIGHT int y = (int)((m.getY() - h.getY()) / 8); // POSITIF == UP NEGATIF == DOWN if (Math.Abs(x) > Math.Abs(y)) return x > 0 ? ACharacter.EOrientation.LEFT : ACharacter.EOrientation.RIGHT; return y > 0 ? ACharacter.EOrientation.UP : ACharacter.EOrientation.DOWN; }
public void updateHeroPosition(Hero h) { heroPos_.X = h.getX() + 8; heroPos_.Y = h.getY() + 8; }