Ejemplo n.º 1
0
        public static void takeDamage()
        {
            if (m_HealthTimer > HEALTH_DELAY_TIMER)
            {
                m_HealthTimer = 0;

                m_Health--;

                Sounds.playSound("UnicornHurt", 1);

                Hud.reduceHealth();
            }
        }
Ejemplo n.º 2
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);

            //stuff to change screen size / fullscreen
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Sounds.loadContent(Content);
            BackgroundMusic.loadContent(Content);
            IsMouseVisible = true;

            hud = new Hud();
            hud.LoadContent(Content);

            screenManager = new ScreenManager();
            screenManager.LoadContent(Content, graphics);

            gateManager    = new GateManager();
            m_EnemyManager = new EnemyManager();
            pickupManager  = new PickUpManager();
            tiles          = new Level(new Rectangle(0, 0, 32, 32), new Rectangle(0, 0, 32, 32));
            tiles.loadContent(Content, "EnchantedForestTileSetUpdated", "Content/Level0.txt");

            EnemyManager.loadContent(Content);
            PickUpManager.loadContent(Content);
            GateManager.loadContent(Content);
            player = new Player(new Vector2(200, 1000), new Rectangle(0, 0, 128, 64), new Rectangle(0, 0, 128, 64));
            player.loadContent(Content);



            camera        = new Camera(GraphicsDevice.Viewport);
            camera.Limits = new Rectangle(0, 0, Level.getWidthOfArray() * tiles.Destination.Width, Level.getHeightOfArray() * tiles.Destination.Height);

            background1 = new Background(camera);
            Background.loadContent(Content, Level.levelCount, 1);
            background1.setParallaxes();

            backgroundManager = new BackgroundManager();
            backgroundManager.addBackground(background1);

            boss = new Boss();
            boss.loadContent(Content);
            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 3
0
 public void rechargeLaser(GameTime gameTime)
 {
     if (m_Shots < 6)
     {
         if (m_RechargeTimer > RECHARGE_DELAY_TIMER)
         {
             m_LaserTimer++;
         }
         if (m_LaserTimer > TOTAL_RECHARGE_TIME)
         {
             m_LaserTimer = 0;
             m_Shots++;
             Hud.increaseLaser();
         }
     }
 }
Ejemplo n.º 4
0
        public void collectedHeart()
        {
            if (m_collectedHeart == true)
            {
                if (m_HealthTimer > HEALTH_DELAY_TIMER)
                {
                    m_HealthTimer = 0;

                    m_Health += 2;

                    Hud.increaseHealth();
                    Hud.increaseHealth();

                    m_collectedHeart = false;
                }
            }
        }
Ejemplo n.º 5
0
        public void laserState(GameTime gameTime)
        {
            if (m_Facing == Facing.LEFT)
            {
                if (m_CrossThingy.X > 0)
                {
                    m_CanShoot = false;
                }
                else if (m_CrossThingy.X < 0 && m_Shots > 0)
                {
                    m_CanShoot = true;
                    if (m_RechargeTimer > RECHARGE_DELAY_TIMER)
                    {
                        m_RechargeTimer = 0;
                        m_LaserTimer    = m_Shots / TOTAL_RECHARGE_TIME;
                        m_LaserManager.activateProjectile(m_PlayerPosition, new Vector2(m_CrossPosition.X - m_PlayerPosition.X + m_Cross.Width / 2, m_CrossPosition.Y - m_PlayerPosition.Y + m_Cross.Height / 2));
                        Sounds.playSound("Laser", 1);
                        m_Shots--;
                        Hud.reduceLaser();
                    }
                }
            }

            if (m_Facing == Facing.RIGHT)
            {
                if (m_CrossThingy.X < 0)
                {
                    m_CanShoot = false;
                }
                else if (m_CrossThingy.X > 0 && m_Shots > 0)
                {
                    m_CanShoot = true;
                    if (m_RechargeTimer > RECHARGE_DELAY_TIMER)
                    {
                        m_RechargeTimer = 0;
                        m_LaserTimer    = m_Shots / TOTAL_RECHARGE_TIME;
                        m_LaserManager.activateProjectile(m_PlayerPosition, new Vector2(m_CrossPosition.X - m_PlayerPosition.X + m_Cross.Width / 2, m_CrossPosition.Y - m_PlayerPosition.Y + m_Cross.Height / 2));
                        Sounds.playSound("Laser", 1);
                        m_Shots--;
                        Hud.reduceLaser();
                    }
                }
            }
        }
Ejemplo n.º 6
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);

            //stuff to change screen size / fullscreen
            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Sounds.loadContent(Content);
            BackgroundMusic.loadContent(Content);
            IsMouseVisible = true;

            hud = new Hud();
            hud.LoadContent(Content);

            screenManager = new ScreenManager();
            screenManager.LoadContent(Content, graphics);

            gateManager = new GateManager();
            m_EnemyManager = new EnemyManager();
            pickupManager = new PickUpManager();
            tiles = new Level(new Rectangle(0, 0, 32, 32), new Rectangle(0, 0, 32, 32));
            tiles.loadContent(Content, "EnchantedForestTileSetUpdated", "Content/Level0.txt");

            EnemyManager.loadContent(Content);
            PickUpManager.loadContent(Content);
            GateManager.loadContent(Content);
            player = new Player( new Vector2(200, 1000),new Rectangle(0, 0, 128, 64), new Rectangle(0, 0, 128,64 ));
            player.loadContent(Content);

            camera = new Camera(GraphicsDevice.Viewport);
            camera.Limits = new Rectangle(0, 0, Level.getWidthOfArray() * tiles.Destination.Width, Level.getHeightOfArray() * tiles.Destination.Height);

            background1 = new Background(camera);
            Background.loadContent(Content, Level.levelCount, 1);
            background1.setParallaxes();

            backgroundManager = new BackgroundManager();
            backgroundManager.addBackground(background1);

            boss = new Boss();
            boss.loadContent(Content);
            // TODO: use this.Content to load your game content here
        }