public AttractScenePacMan() { Visible = true; _animDirection = new TwoFrameAnimation(65.Milliseconds()); Direction = Directions.Left; const float left = 456; const float left2 = 472; _velocitiesLookup = new Dictionary <Directions, FramePair> { [Directions.Up] = new FramePair( new Vector2(left, 32), new Vector2(left2, 32)), [Directions.Down] = new FramePair( new Vector2(left, 48), new Vector2(left2, 48)), [Directions.Left] = new FramePair( new Vector2(left, 16), new Vector2(left2, 16)), [Directions.Right] = new FramePair( new Vector2(left, 0), new Vector2(left2, 0)) }; Position = Tile.ToCenterCanvas(new Vector2(13.5f, 23)); setSpriteSheetPointers(); }
void resetAll(bool isDemoMode = false) { Visible = true; _demoKeyPresses.Reset(); _isDemoMode = isDemoMode; _direction = Directions.Left; _speed = Constants.PacManBaseSpeed; _dyingFramePointer = 0; Position = Tile.ToCenterCanvas(new Vector2(13.5f, 23)); _lifeStatus = LifeStatus.Alive; _animDirection = new TwoFrameAnimation(65.Milliseconds()); _frame1InSpriteMap = _framePointers[_direction].Frame1; _frame2InSpriteMap = _framePointers[_direction].Frame2; _spriteSheetPos = _frame1InSpriteMap; }
public PacMan(IMaze maze, IHumanInterfaceParser input, IMediator mediator) { _maze = maze; _input = input; _mediator = mediator; _demoKeyPresses = new DemoKeyPresses(); _lifeStatus = LifeStatus.Alive; _tile = new Tile(); _keyPress = new KeyPressedEvent(); _framePointers = new Dictionary <Directions, FramePointers>(); const int left = 456; const int left2 = 472; _framePointers[Directions.Up] = new FramePointers( new Vector2(left, 32), new Vector2(left2, 32)); _framePointers[Directions.Down] = new FramePointers( new Vector2(left, 48), new Vector2(left2, 48)); _framePointers[Directions.Left] = new FramePointers( new Vector2(left, 16), new Vector2(left2, 16)); _framePointers[Directions.Right] = new FramePointers( new Vector2(left, 0), new Vector2(left2, 0)); _dyingFrames = new List <Vector2>(); _dyingFramePointer = 0; for (var i = 0; i < 12; i++) { _dyingFrames.Add(new Vector2(489 + i * 16, 0)); } _animDirection = new TwoFrameAnimation(65.Milliseconds()); Reset(); }