Example #1
0
 public Hud(int x, int y, int w, int h, SpriteBatch s, Player p, Camera g, Level level)
     : base(x, y, w, h)
 {
     sprite = s;
     player = p;
     view = g;
     Check();
 }
Example #2
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()
        {
            // TODO: Add your initialization logic here
            player = new Player(100,100,60,60); // TODO: give player actual rectangle values

            g = GameState.Menu;

            world = new World(GameVariables.menuWorld, s); // Menu "world"
            pause = false;

            // x y width height are temporary filler values
            //gameHUD = new Hud(50, 20, 700, 180, spriteBatch, player, world.Levels[0].HudInfo , (GameVariables.menuWorld + " - " + (world.currentLevel + 1).ToString()));

            player.ObjPos.X = world.Levels[0].playerSpawn.X;
            player.ObjPos.Y = world.Levels[0].playerSpawn.Y;

            moveCamera = new Camera(player, GraphicsDevice);

            width = GraphicsDevice.Viewport.Width;
            height = GraphicsDevice.Viewport.Height;

            base.Initialize();
        }
Example #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            player.LoadContent(Content);
            GameVariables.LoadContentFiles(Content);

            // TODO: use this.Content to load your game content here

            pauseBack = Content.Load<Texture2D>(GameVariables.imgWall);
            gameFont = Content.Load<SpriteFont>(GameVariables.gFont);
            gameFont2 = Content.Load<SpriteFont>(GameVariables.gFont2);
            deathScreen = Content.Load<Texture2D>(@"ContentFiles/Images/Sprites/death");
            victoryScreen = Content.Load<Texture2D>(@"ContentFiles/Images/Sprites/Victory");
            menu = new AnimatedTexture(Content, @"ContentFiles/Images/Sprites/fronta", 5, .05f);

            world = new World(GameVariables.menuWorld, s, player, Content); // Menu "world"
            world.LoadWorld();

            player.ObjPos.X = world.levels["main.txt"].playerSpawn.X;
            player.ObjPos.Y = world.levels["main.txt"].playerSpawn.Y;
            world.currentLevel = "main.txt";

            moveCamera = new Camera(player, GraphicsDevice);
            gameHUD = new Hud((int)moveCamera.camX + 20, (int)moveCamera.camY + 20, 300, 45, spriteBatch, player, moveCamera, world.levels[world.currentLevel]);

            falling = new SoundLoop(GameVariables.fallingLoopInstance1, 700, GameVariables.fallingLoopInstance2, 700, GameVariables.fallingAccelerationInstance, 850);
            robotMovement = new SoundLoop(GameVariables.robotSoundInstance1, 690, GameVariables.robotSoundInstance2, 690);

            gameHUD.backt = Content.Load<Texture2D>(@"ContentFiles/Images/Sprites/back");
            gameHUD.undert = Content.Load<Texture2D>(@"ContentFiles/Images/Sprites/grey");
            gameHUD.energyt = Content.Load<Texture2D>(@"ContentFiles/Images/Sprites/energy");
        }