예제 #1
0
        public void attemptInsertAtCursor(ref TileQueue tileQueue)
        {
            BloodyTile nextTile = tileQueue.Peek();
            Vector2 cursorPos = cursor.getGridPosition();

            if (canInsert(nextTile, (int)cursorPos.X, (int)cursorPos.Y))
            {
                insert(tileQueue.Pull(), (int)cursorPos.X, (int)cursorPos.Y);
                tileQueue.Push(generateRandomTile());
            }
            else
            {
                //cursor.signalError();
                // play error sound
                Debug.WriteLine("Cannot place tile {0} at {1}, {2}", nextTile.GetType().Name, (int)cursorPos.X, (int)cursorPos.Y);
            }
        }
예제 #2
0
파일: Game1.cs 프로젝트: dashogun/GGJ2013
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            Input = new Input();
            Mode = GameMode.Menu;
            Menu = new Menu(new String[]{"Start Easy Game", "Start Medium Game", "Start Hard Game", "Exit", "Help"});
            ScreenWidth = 800;
            ScreenHeight = 800;
            Graphics.PreferredBackBufferWidth = ScreenWidth;
            Graphics.PreferredBackBufferHeight = ScreenHeight;
            Graphics.ApplyChanges();

            base.Initialize();

            Rectangle gridArea = new Rectangle(
                ScreenWidth / 10,
                ScreenHeight / 10,
                ScreenWidth - 2 * (ScreenWidth / 10),
                ScreenHeight - 2 * (ScreenHeight / 10));
            _grid = new BloodyGrid(10, 10, gridArea);

            int lookaheadXPos = ScreenWidth - (ScreenWidth / 10) + (ScreenWidth / 100);
            int lookaheadWidth = (ScreenWidth / 12);
            TileLookahead = new TileQueue(lookaheadXPos, lookaheadWidth);

            int BPxPos = (ScreenWidth / 100);
            int BPWidth = (ScreenWidth / 12);
            BP = new BloodPressure(BPxPos, BPWidth);
        }