コード例 #1
0
        /// <summary>
        /// draw tile map and entities
        /// </summary>
        /// <param name="gameTime"></param>
        public virtual void Draw(GameTime gameTime)
        {
            ScreenManager.StartCameraSpriteBatch();
            DrawTiles(gameTime);
            Player.Draw(gameTime);

            if (grabberEnemies.Count != 0)
            {
                foreach (GrabberEnemy enemy in grabberEnemies)
                {
                    enemy.Draw(gameTime);
                }
            }

            //draw a transparent water tile over top
            foreach (Rectangle waterTile in waterTiles)
            {
                ScreenManager.SpriteBatch.Draw(atlas, waterTile, ImageTools.GetSourceRect(3, 0), Color.White);
            }

            ScreenManager.EndCameraSpriteBatch();
        }
コード例 #2
0
        /// <summary>
        /// load game content
        /// </summary>
        public override void LoadContent()
        {
            Pausable = true;
            ScreenOrder.SaveScreen(this);

            SoundManager.PlaySong("Boss_3", true);

            level            = new Level("Levels/endBoss.bmp");
            level.TileSetRow = 2;
            level.LoadLevel();
            level.CamType = "static";


            bossAnim           = new Animation(ImageTools.LoadTexture2D("Characters/Bosses/wraith_animation"), new int[] { 0, 1, 2, 3, 4, 5, 0 }, 384, false);
            bossAnim.FrameTime = .1f;
            boss = new Boss(10);

            eyeD          = ImageTools.LoadTexture2D("Characters/Bosses/eyeball_D");
            boss.Position = new Vector2(500, 20);
            velocity      = new Vector2(2, 0);

            leftBound  = new Rectangle(0, 0, 10, 300);
            rightBound = new Rectangle(1270, 0, 10, 300);

            boss.Projectiles.Add(new ShadowBall(level.Player, new Vector2(0, 5), new Vector2(150, 0)));
            boss.Projectiles.Add(new ShadowBall(level.Player, new Vector2(0, 5), new Vector2(350, 0)));
            boss.Projectiles.Add(new ShadowBall(level.Player, new Vector2(0, 5), new Vector2(550, 0)));
            boss.Projectiles.Add(new ShadowBall(level.Player, new Vector2(0, 5), new Vector2(750, 0)));
            boss.Projectiles.Add(new ShadowBall(level.Player, new Vector2(0, 5), new Vector2(950, 0)));
            boss.Projectiles.Add(new ShadowBall(level.Player, new Vector2(0, 5), new Vector2(1150, 0)));

            background = new ParallaxBackground(ImageTools.LoadTexture2D("Graphics/Backgrounds/cave_level_3_background"),
                                                ImageTools.LoadTexture2D("Graphics/Backgrounds/cave_level_3_bottom_parallax"),
                                                ImageTools.LoadTexture2D("Graphics/Backgrounds/cave_level_3_top_parallax"));


            base.LoadContent();
        }
コード例 #3
0
        /// <summary>
        /// load assets
        /// </summary>
        public override void LoadContent()
        {
            Pausable = true;
            ScreenOrder.SaveScreen(this);

            SoundManager.PlaySong("Hello", true);

            level = new Level("Levels/wakeUp.bmp");
            level.LoadLevel();
            level.CamType = "center";
            level.Player.MovementEnabled = false;

            dbox = new DialogueBox("Scripts/wakeUpScript.txt");
            dbox.LoadDBox();

            overlay = ImageTools.LoadTexture2D("Graphics/Overlays/lightning");

            background = new ParallaxBackground(ImageTools.LoadTexture2D("Graphics/Backgrounds/cave_level_1_background"),
                                                ImageTools.LoadTexture2D("Graphics/Backgrounds/cave_level_1_bottom_parallax"),
                                                ImageTools.LoadTexture2D("Graphics/Backgrounds/cave_level_1_top_parallax"));

            base.LoadContent();
        }
コード例 #4
0
        /// <summary>
        /// load assets
        /// </summary>
        public override void LoadContent()
        {
            SoundManager.PlaySong("Loop-1", true);

            ScreenManager.LightingEnabled = true;
            ScreenManager.LightingEngine.AmbientLightPower = 0.3f;

            belowLogo = ImageTools.LoadTexture2D("Graphics/Logos/below_logo");

            startButton      = new Button();
            startButton.Text = "Play";
            startButton.Location(540, 500);

            optionsButton      = new Button();
            optionsButton.Text = "Options";
            optionsButton.Location(540, 580);

            creditsButton      = new Button();
            creditsButton.Text = "Credits";
            creditsButton.Location(540, 660);

            exitButton      = new Button();
            exitButton.Text = "Exit";
            exitButton.Location(540, 740);

            resetButton      = new Button();
            resetButton.Text = "Reset Game";
            resetButton.Location(20, 890);
            resetButton.HoverColor     = Color.Red;
            resetButton.HoverTextColor = Color.Red;

            background = ImageTools.LoadTexture2D("Graphics/Backgrounds/mountain");



            base.LoadContent();
        }
コード例 #5
0
ファイル: Player.cs プロジェクト: hvak/Below
        /// <summary>
        /// load player content
        /// </summary>
        public void LoadContent()
        {
            Health  = new Health(5, true);
            Canteen = new Canteen(this);

            playerStanding = ImageTools.LoadTexture2D("Characters/Player/standing");
            playerForward  = new Animation(ImageTools.LoadTexture2D("Characters/Player/character_walk_right"), 6, true);
            playerBackward = new Animation(ImageTools.LoadTexture2D("Characters/Player/character_walk_backward"), 4, true);
            playerJump     = new Animation(ImageTools.LoadTexture2D("Characters/Player/jump"), 1, true);


            arm         = ImageTools.LoadTexture2D("Characters/Player/arm");
            armPosition = new Rectangle((int)position.X, (int)position.Y, arm.Width, arm.Height);

            lightPos = new Vector2(-300, -300);


            ScreenManager.LightingEngine.ClearLights();            //so light doesen't stay when new level is loaded
            flashLight = new SpotLight()
            {
                IsEnabled             = true,
                Color                 = Color.White,
                Power                 = 1f,
                LightDecay            = 200,
                Position              = new Vector3(lightPos.X, lightPos.Y, 5), //position.z controls width of the focus
                SpotBeamWidthExponent = 36,
                DirectionZ            = 0f                                      //0f//-.1f
            };
            flashLight.SpotRotation = 1f;
            ScreenManager.LightingEngine.AddLight(flashLight);

            boundingRectangle = new Rectangle(0, 0, 32, 64);


            setLineOfSight();
        }
コード例 #6
0
ファイル: Boss2Screen.cs プロジェクト: hvak/Below
        /// <summary>
        /// draw screen content under lighting
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime)
        {
            background.Draw();

            level.Draw(gameTime);

            ScreenManager.SpriteBatch.Begin();

            ScreenManager.SpriteBatch.Draw(wallBoss, new Vector2(1280 - wallBoss.Width, 0), Color.White);

            ScreenManager.SpriteBatch.End();

            ScreenManager.StartCameraSpriteBatch();
            //draw each eye with the custom rotation
            for (int i = 0; i < eyes.Count; i++)
            {
                ScreenManager.SpriteBatch.Draw(eyes[i], eyePos[i], null, Color.White, ImageTools.Rotation(eyePos[i], level.Player.Position), new Vector2(eyes[i].Width / 2, eyes[i].Height / 2), 1, SpriteEffects.None, 1);
            }
            ScreenManager.EndCameraSpriteBatch();

            //draw the shadow balls
            boss.DrawProjectiles();

            base.Draw(gameTime);
        }
コード例 #7
0
        /// <summary>
        /// draw stuff under lighting
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime)
        {
            background.Draw();

            level.Draw(gameTime);

            ScreenManager.SpriteBatch.Begin();

            if (timer >= 6)
            {
                bossAnim.PlayAnimation(gameTime, boss.Position, SpriteEffects.None);
            }
            else
            {
                bossAnim.DrawFrame(0, boss.Position, SpriteEffects.None);
            }

            ScreenManager.SpriteBatch.Draw(eyeD, boss.Position + new Vector2(51, 27), null, Color.White, ImageTools.Rotation(boss.Position + new Vector2(51, 27), level.Player.Position), new Vector2(eyeD.Width / 2, eyeD.Height / 2), 1, SpriteEffects.None, 1);

            ScreenManager.SpriteBatch.End();

            boss.DrawProjectiles();



            base.Draw(gameTime);
        }
コード例 #8
0
        private Color color = Color.Transparent;        //the color that will be manipulated to create the lightning effect

        //load sound effects

        /// <summary>
        /// create instance and load content
        /// </summary>
        public ThunderStorm()
        {
            rain      = new RainGenerator(ImageTools.LoadTexture2D("Graphics/Particles/raindrop"), 500, ScreenManager.SCREEN_WIDTH + 150);
            lightning = ImageTools.LoadTexture2D("Graphics/Overlays/lightning");
            random    = new Random();
        }
コード例 #9
0
        /// <summary>
        /// load assets
        /// </summary>
        public override void LoadContent()
        {
            logo = ImageTools.LoadTexture2D("Graphics/Logos/cognitive");

            base.LoadContent();
        }
コード例 #10
0
        /// <summary>
        /// draw graphics
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime)
        {
            background.Draw();
            level.Draw(gameTime);

            ScreenManager.SpriteBatch.Begin();

            Vector2 position = new Vector2(100, 300);

            bossAnim.DrawFrame(0, position, SpriteEffects.None);
            ScreenManager.SpriteBatch.Draw(eyeD, position + new Vector2(51, 27), null, Color.White, ImageTools.Rotation(position + new Vector2(51, 27), level.Player.Position), new Vector2(eyeD.Width / 2, eyeD.Height / 2), 1, SpriteEffects.None, 1);

            ScreenManager.SpriteBatch.End();

            base.Draw(gameTime);
        }
コード例 #11
0
 /// <summary>
 /// load tile with the collumn index
 /// </summary>
 /// <param name="textureName"></param>
 /// <param name="collision"></param>
 /// <returns></returns>
 private Tile LoadTile(int collumnIndex, TileCollision collision)
 {
     return(new Tile(ImageTools.GetSourceRect(TileSetRow, collumnIndex), collision));
 }
コード例 #12
0
        /// <summary>
        /// load logo
        /// </summary>
        public override void LoadContent()
        {
            logo = ImageTools.LoadTexture2D("Graphics/Logos/sharkboylogo");

            base.LoadContent();
        }
コード例 #13
0
ファイル: ForestScreen.cs プロジェクト: hvak/Below
        /// <summary>
        /// load game content
        /// </summary>
        public override void LoadContent()
        {
            Pausable = true;
            ScreenOrder.SaveScreen(this);

            SoundManager.PlaySong("Forest", true);
            SoundManager.AddLoopingSound("rainlong", .05f);

            level            = new Level("Levels/forest.bmp");
            level.TileSetRow = 0;
            level.LoadLevel();
            level.CamType = "center";


            cave       = ImageTools.LoadTexture2D("Graphics/Misc/cave");
            caveBounds = new Rectangle(4541, 512 - 64, 32 * 4, 64 * 2);

            storm = new ThunderStorm();

            background = new ParallaxBackground(ImageTools.LoadTexture2D("Graphics/Backgrounds/sun_background"),
                                                ImageTools.LoadTexture2D("Graphics/Backgrounds/mountains_parallax"), ImageTools.LoadTexture2D("Graphics/Backgrounds/clouds_parallax"));

            dbox = new DialogueBox("Scripts/forestScript.txt");
            dbox.LoadDBox();
            dbox.IsActive = true;

            dbox2 = new DialogueBox("Scripts/forestScript2.txt");
            dbox2.LoadDBox();

            controls = new List <string>();
            controls.Add("Use <A> and <D> to move left and right and <W> or <Space> to jump.");
            controls.Add("This is your canteen.\nPress <Q> to take  a drink  and heal for 1 health.");
            controls.Add("This is your current health.");
            controls.Add("You can refill your canteen by interacting, <E>, with ponds like this.");
            controls.Add("Use the mouse to move your flashlight around.");
            controls.Add("You can pause the game by pressing <Escape>");

            controlsPos = new List <Vector2>();
            controlsPos.Add(level.Player.Position - new Vector2(210, 200));
            controlsPos.Add(new Vector2(1280 - 500, 960 - 75));
            controlsPos.Add(new Vector2(1280 - 245, 115));
            controlsPos.Add(new Vector2(2688 - 200, 416 + 70));
            controlsPos.Add(level.Player.Position - new Vector2(130, 150));
            controlsPos.Add(new Vector2(TextTools.CenterText(ScreenManager.ExtraSmallFont, controls[5]).X, 50));


            friend1           = new Animation(ImageTools.LoadTexture2D("Characters/Friends/pat"), new int[] { 0, 0, 0, 0, 0, 1 }, 32, true);
            friend1.FrameTime = .75f;
            f1Pos             = level.Player.Position + new Vector2(64, 0);

            friend2           = new Animation(ImageTools.LoadTexture2D("Characters/Friends/naomi"), new int[] { 0, 0, 1, 0, 0, 0 }, 32, true);
            friend2.FrameTime = .75f;
            f2Pos             = f1Pos + new Vector2(50, 0);

            friendBoundingBox = new Rectangle((int)f1Pos.X, (int)f1Pos.Y, 64 + 18, 64);

            ScreenManager.LightingEngine.SetLightPower(3);

            base.LoadContent();
        }
コード例 #14
0
ファイル: ShadowCamera.cs プロジェクト: hvak/Below
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="Level"></param>
 public ShadowCamera(Level Level)
 {
     level          = Level;
     shadowLocation = ScreenManager.Camera.Position + new Vector2(20, 20);
     shadow         = ImageTools.LoadTexture2D("Characters/Enemies/shadow_wall");
 }