コード例 #1
0
        private Tuple <int, int> WishedDirection; // direction pacman wants to change to

        public Pacman(int x, int y, GamePlan gamePlan, char directionChar) : base(x, y, gamePlan)
        {
            this.DirectionChar = directionChar;
            switch (directionChar)
            {
            case '>':
                this.Direction = DirectionGlobal.CharToDirection['>'];
                break;

            case '<':
                this.Direction = DirectionGlobal.CharToDirection['<'];
                break;

            case '^':
                this.Direction = DirectionGlobal.CharToDirection['^'];
                break;

            case 'v':
                this.Direction = DirectionGlobal.CharToDirection['v'];
                break;

            default:
                this.Direction = DirectionGlobal.CharToDirection['>'];
                break;
            }

            this.WishedDirection = Direction;
        }
コード例 #2
0
 public Ghost(int x, int y, GamePlan gamePlan, GhostMode mode, int homeTileX, int homeTileY) : base(x, y, gamePlan)
 {
     this.mode            = mode;
     this.startMode       = mode;
     this.startTileX      = x;
     this.startTileY      = y;
     this.homeTileX       = homeTileX;
     this.homeTileY       = homeTileY;
     this.modeLastChanged = TimeSpan.FromSeconds(0);
     this.direction       = new Tuple <int, int>(0, 0);
 }
コード例 #3
0
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            _graphics.PreferredBackBufferWidth  = 25 * Global.PICTURESIZE;
            _graphics.PreferredBackBufferHeight = 26 * Global.PICTURESIZE;
            _graphics.ApplyChanges();

            Content.RootDirectory = "Content";
            IsMouseVisible        = true;

            gamePlan = new GamePlan(Global.PATH_TO_MAP_FILE, Global.DOTPOINTS, Global.GHOSTPOINTS,
                                    new int[] { 12, 8 }, new int[] { 0, 0 },
                                    new [] { 10, 10 }, new [] { 24, 0 },
                                    new [] { 11, 10 }, new [] { 0, 22 },
                                    new [] { 14, 11 }, new [] { 24, 22 });
            //ToDo: Change to relative path
            gameMode = GameMode.Start;

            levelData = new LevelData(Global.PATH_TO_DATA_FILE);

            this.TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 180); // how often update is called
        }
コード例 #4
0
 public Item(int x, int y, GamePlan gamePlan)
 {
     this.x        = x;
     this.y        = y;
     this.gamePlan = gamePlan;
 }