Esempio n. 1
0
 public Spout(Game game, int xPos, int yPos, int screenWidth, int screenHeight, int _orientation, Texture2D _spoutTexture, Level level)
 {
     position = new Rectangle();
     position.Width = screenWidth / colsPerScreen;
     position.Height = screenHeight / rowsPerScreen;
     spoutTexture = _spoutTexture;
     position.X = xPos * position.Width;
     position.Y = yPos * position.Height;
     orientation = _orientation;
     parentLevel = level;
     region = new Rectangle(orientation * spriteWidth, 0, spriteWidth, spriteHeight);
 }
Esempio n. 2
0
        public Gate(Game game, int xPos, int yPos, int screenWidth, int screenHeight, Texture2D texture, Level _parentLevel)
        {
            parentLevel = _parentLevel;
            position = new Rectangle();
            position.Width = screenWidth / colsPerScreen;
            position.Height = screenHeight / rowsPerScreen;

            position.X = xPos * position.Width;
            position.Y = yPos * position.Height;

            leftHalf = new Rectangle(0, 0, spriteWidth, spriteHeight);
            rightHalf = new Rectangle(spriteWidth, 0, spriteWidth, spriteHeight);

            state = GateState.closed;
            status = GateStatus.closing;
            ticker = -1;
            gateTexture = texture;

            /* Block off the right half of the gate right now */
            Rectangle changeRect = new Rectangle((position.X / position.Width) + 1, position.Y / position.Height, 1, 4);
            parentLevel.modifyTiles(changeRect, CollisionType.invisible);
        }
        /// <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()
        {
            base.Initialize();
            gameState = GameState.titleScreen;
            prevGameState = gameState;
            inputHandler = new InputHandler();

            plotScreen = new PlotScreen(this, musicPlayer, textures, fonts);
            level = new Level(this, textures, fonts, sounds, musicPlayer, plotScreen, new LevelLoader(config.LevelFiles), inputHandler);
            tutorial = new Level(this, textures, fonts, sounds, musicPlayer, null, new LevelLoader(config.TutorialFiles), inputHandler);
            gameOver = new GameOver(this, (Texture2D)textures[3], (SpriteFont)fonts[2], inputHandler);
            titleScreen = new TitleScreen(this, (Texture2D)textures[7], (Texture2D)textures[16], (SpriteFont)fonts[2], musicPlayer, inputHandler);
            titleMenu = new TitleMenu(this, (Texture2D)textures[7], (SpriteFont)fonts[2], inputHandler);
            levelIntroScreen = new LevelIntroScreen(this, (SpriteFont)fonts[1]);
            levelIntroScreen.InitLevelScreen(level.LevelName);

            credits = new Credits(this, (Texture2D)textures[creditsIndex], musicPlayer, fonts);

            playerAnimation = new PlayerAnimation(this, new Player(this, (Texture2D)textures[0], sounds, -100, 400));
            animatePlayer = false;
        }
Esempio n. 4
0
        /// <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()
        {
            base.Initialize();
            gameState = GameState.titleScreen;
            prevGameState = gameState;
            inputHandler = new InputHandler();

            plotScreen = new PlotScreen(this, musicPlayer, textures, fonts);
            level = new Level(this, textures, fonts, sounds, musicPlayer, plotScreen, new LevelLoader(config.LevelFiles), inputHandler);
            tutorial = new Level(this, textures, fonts, sounds, musicPlayer, null, new LevelLoader(config.TutorialFiles), inputHandler);
            gameOver = new GameOver(this, (Texture2D)textures[3], (SpriteFont)fonts[2], inputHandler);
            titleScreen = new TitleScreen(this, (Texture2D)textures[7], (Texture2D)textures[16], (SpriteFont)fonts[2], musicPlayer, inputHandler);
            titleMenu = new TitleMenu(this, (Texture2D)textures[7], (SpriteFont)fonts[2], inputHandler);
            levelIntroScreen = new LevelIntroScreen(this, (SpriteFont)fonts[1]);
            levelIntroScreen.InitLevelScreen(level.LevelName);

            credits = new Credits(this, (Texture2D)textures[creditsIndex], musicPlayer, fonts);

            playerAnimation = new PlayerAnimation(this, new Player(this, (Texture2D)textures[0], sounds, -100, 400));
            animatePlayer = false;

            int screenWidth = graphics.GraphicsDevice.Viewport.Width;
            int screenHeight = graphics.GraphicsDevice.Viewport.Height;

            //initializing virtual screen resolution to be mapped to the actual screen
            Resolution.Init(ref graphics);
            Resolution.SetVirtualResolution(screenWidth, screenHeight);
            Resolution.SetResolution(800, 600, true);
        }