コード例 #1
0
    public override void Draw()
    {
        Bitmap _OctopusBitMap;

        _OctopusBitMap = new Bitmap("Octopus", "Monster.png");
        SplashKit.DrawBitmap(_OctopusBitMap, X, Y);
    }
コード例 #2
0
    public void Draw()
    {
        SplashKit.DrawBitmap(_Background, 0, 0);
        switch (_ActiveMenu)
        {
        case Menu.MainMenu:
            DrawMenu(_MainMenu);
            break;

        case Menu.AttackMenu:
            DrawMenu(_AttackMenu);
            break;

        case Menu.HealMenu:
            DrawMenu(_HealMenu);
            break;

        case Menu.MessageBox:
            _MessageBox.Draw();
            break;
        }

        _Player.Draw();
        _Enemy.Draw();
        DrawMenu(_VolMenu);
        DrawDefeatedBox();
        _InstructionsCloseButton.Draw();

        if (_InstructionsToggle)
        {
            DrawInstructions();
        }
    }
コード例 #3
0
 public void Draw()
 {
     _Window.Clear(Color.White);
     _GameLevel.Draw();
     _Player.Draw(_Window);
     foreach (Isopod isopod in _Isopods)
     {
         isopod.Draw(_Window);
     }
     foreach (Item item in _Items)
     {
         item.Draw(_Window);
     }
     foreach (Obstacle obstacle in _Obstacles)
     {
         obstacle.Draw(_Window);
     }
     SplashKit.DrawText(_Player.Health.ToString() + "%", Color.White, 188, 70);
     if (levelCount == 1)
     {
         _startMonument.Draw();
         if (_startMonument.HasPlayerNear(_Player))
         {
             SplashKit.DrawText("Monument De Butch: 'e'", Color.White, _startMonument.X - _startMonument.Width / 8, _startMonument.Y - _startMonument.Width / 8);
             if (SplashKit.KeyDown(KeyCode.EKey))
             {
                 SplashKit.DrawBitmap("ButchyHistory.png", _Window.Width / 20, _Window.Height / 20);
             }
         }
     }
     _Window.Refresh();
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: tonyphan04/OOP
        public static void Main()
        {
            Bitmap    background = SplashKit.LoadBitmap("background1", "background1.png");
            Aircraft  a          = new Aircraft();
            GameRules gr         = new GameRules();

            new Window("Aircraft One", 600, 800);

            while (!SplashKit.WindowCloseRequested("Aircraft One"))
            {
                SplashKit.ProcessEvents();
                SplashKit.ClearScreen();
                if (a.Lives > 0)
                {
                    SplashKit.DrawBitmap(background, 0, -100);
                    SplashKit.DrawText("Lives:" + a.Lives, Color.White, 5, 10);
                    SplashKit.DrawText("Score:" + a.Score, Color.White, 5, 30);
                    a.Draw();
                    a.Move();
                    SplashKit.HideMouse();
                    gr.ResetCollector();
                    gr.AddItem();
                    gr.DrawItem();
                    gr.MoveItem();
                    gr.AddObstacle();
                    gr.DrawObstacle();
                    gr.MoveProjectile();
                    gr.MoveObstacle();
                    gr.DrawProjectile();
                    gr.AddProjectile(a);
                    gr.Healing(a);
                    gr.Collision(a);
                    gr.CollisionProjectile(a);
                    if (a.Lives <= 0)
                    {
                        a.Alive = false;
                    }

                    if (a.Alive == false)
                    {
                        a.Lives          -= 1;
                        a.ProjectileImage = SplashKit.LoadBitmap("hadoken", "hadoken.png");
                        a.X     = SplashKit.MouseX();
                        a.Y     = SplashKit.MouseY();
                        a.Alive = true;
                    }
                    gr.CheckObstacle(a);
                    gr.Check();
                    gr.RemoveObj();
                }
                else
                {
                    SplashKit.DrawText("Game Over", Color.Black, 300, 100);
                    SplashKit.ShowMouse();
                }


                SplashKit.RefreshScreen();
            }
        }
コード例 #5
0
        public void Draw()
        {
            _GameWindow.Clear(Color.DeepSkyBlue);

            SplashKit.DrawBitmap(_backgroundBitmap, 0, 0);

            string fishEaten = _fishEaten.Count.ToString();

            var font = SplashKit.LoadFont("Hand Scribble Sketch Times",
                                          "./resources/fonts/Hand Scribble Sketch Times.otf");

            SplashKit.DrawText($"Score: {fishEaten}", Color.Black, font, 30, 1400, 100);

            foreach (var fish in _fishes)
            {
                fish.Draw();
            }

            _Player.Draw();

            SplashKit.DrawBitmap(_seeWeedBitmap, 800, 700);


            _GameWindow.Refresh(60);
        }
コード例 #6
0
        public override void DrawEntity(CDraw toDraw) //draws regular entities (not players)
        {
            float absX = toDraw.X * Settings.CellWidth;
            float absY = toDraw.Y * Settings.CellHeight;

            SplashKit.DrawBitmap(SplashKit.BitmapNamed("Air"), absX, absY);
            SplashKit.DrawBitmap(SplashKit.BitmapNamed(toDraw.Type.ToString()), absX, absY);
        }
コード例 #7
0
        public void Draw() // Draws the player to the screen
        {
            var x = X;
            var y = Y;

            //DrawingOptions scale = SplashKit.OptionScaleBmp(1, 1);
            SplashKit.DrawBitmap(_PlayerBitmap, x, y);
        }
コード例 #8
0
        public static void Main()
        {
            Bitmap   background = SplashKit.LoadBitmap("background", "background.png");
            Chicken  c          = new Chicken();
            GameMain game       = new GameMain();

            new Window("Chicken Invaders", 600, 800);
            while (!SplashKit.WindowCloseRequested("Chicken Invaders"))
            {
                SplashKit.ProcessEvents();
                SplashKit.ClearScreen();
                if (c.Hearts > 0)
                {
                    SplashKit.DrawBitmap(background, 0, -100);
                    SplashKit.DrawText("Hearts: " + c.Hearts, Color.Black, 5, 10);
                    SplashKit.DrawText("Score: " + c.Score, Color.Black, 5, 30);
                    c.Draw();
                    c.Move();
                    SplashKit.HideMouse();
                    game.ResetCollector();
                    game.AddHeart();
                    game.DrawHeart();
                    game.MoveHeart();
                    game.DrawObstacle();
                    game.AddObstacle();
                    game.MoveBullet();
                    game.DrawBullet();
                    game.MoveObstacle();
                    game.AddBullet(c);
                    game.Recover(c);
                    game.Collision(c);
                    game.CollisionBullet(c);

                    if (c.Hearts <= 0)
                    {
                        c.Alive = false;
                    }

                    if (c.Alive == false)
                    {
                        c.Hearts      = c.Hearts - 1;
                        c.BulletImage = SplashKit.LoadBitmap("bullet", "bullet.png");
                        c.X           = SplashKit.MouseX();
                        c.Y           = SplashKit.MouseY();
                        c.Alive       = true;
                    }
                    game.CheckObstacle(c);
                    game.Check();
                    game.RemoveObject();
                }
                else
                {
                    SplashKit.DrawText("Game Over", Color.Black, 260, 400);
                    SplashKit.ShowMouse();
                }
                SplashKit.RefreshScreen();
            }
        }
コード例 #9
0
        // draw lives on lifeboard
        /// <summary>
        /// Draw lives on lifeboard
        /// </summary>
        /// <param name="player"></param>
        /// <param name="windowWidth"></param>
        private void DrawLife(Player player, double windowWidth)
        {
            // lives
            Bitmap lives = new Bitmap("lives", "lives.png");

            for (int i = 0; i < player.Lives; i++)
            {
                SplashKit.DrawBitmap(lives, windowWidth - (player.Lives - i) * 52, 250);
            }
        }
コード例 #10
0
 public RouletteBoard(Window window, Load user, PastRolls rolls)
 {
     _window = window;
     _user   = user;
     window.Clear(SplashKit.RGBColor(0, 129, 62));
     SplashKit.DrawBitmap(_mainBoard, XOffset(), YOffset());
     if (PastRolls.rolling)
     {
         UpdateBalance(user);
     }
     window.Refresh();
 }
コード例 #11
0
        public void Display()
        {
            SplashKit.ProcessEvents();
            SplashKit.ClearScreen();
            SplashKit.DrawBitmap("Background", 0, 0);
            Game.getInstance().LoadLevel(true);
            Game.getInstance().DisplayText.Clear();
            if (!startup)
            {
                Game.getInstance().Buttons.Clear();
                Game.getInstance().ButtonColor.Clear();
                Game.getInstance().ButtonColor.AddRange(Enumerable.Repeat(Game.getInstance().DefaultColor, 3));
                startup = true;
            }
            Game.getInstance().ButtonColor.AddRange(Enumerable.Repeat(Game.getInstance().DefaultColor, 3));
            Game.getInstance().DisplayText.Add(new Text("Paradigm  Jump", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 75, 50, 50));
            Game.getInstance().DisplayText.Add(new Text("Start", Game.getInstance().ButtonColor[0], Game.getInstance().DefaultFont, 35, 340, 175));
            Game.getInstance().DisplayText.Add(new Text("Exit", Game.getInstance().ButtonColor[1], Game.getInstance().DefaultFont, 35, 355, 250));
            Game.getInstance().DisplayText.Add(new Text("Modifier", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 25, 570, 180));
            Game.getInstance().DisplayText.Add(new Text("NoFail", Game.getInstance().ButtonColor[2], Game.getInstance().DefaultFont, 20, 560, 230));
            Game.getInstance().DisplayText.Add(new Text("Fast", Game.getInstance().ButtonColor[3], Game.getInstance().DefaultFont, 20, 575, 280));
            Game.getInstance().DisplayText.Add(new Text("Easy", Game.getInstance().ButtonColor[4], Game.getInstance().DefaultFont, 20, 575, 330));
            Game.getInstance().DisplayText.Add(new Text("Can't Fail", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 10, 660, 235));
            Game.getInstance().DisplayText.Add(new Text("Faster and", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 10, 660, 280));
            Game.getInstance().DisplayText.Add(new Text("Smaller Cubes", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 10, 660, 290));
            Game.getInstance().DisplayText.Add(new Text("Slower and", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 10, 660, 330));
            Game.getInstance().DisplayText.Add(new Text("Bigger Cubes", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 10, 660, 340));
            Game.getInstance().DisplayText.Add(new Text("How to play", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 25, 50, 180));
            Game.getInstance().DisplayText.Add(new Text("A - Move Left", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 15, 50, 220));
            Game.getInstance().DisplayText.Add(new Text("D - Move Right", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 15, 50, 240));
            Game.getInstance().DisplayText.Add(new Text("S - Drop Down", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 15, 50, 260));
            Game.getInstance().DisplayText.Add(new Text("Space - Jump", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 15, 50, 280));
            Game.getInstance().DisplayText.Add(new Text("RShift - Dash", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 15, 50, 300));
            int index = Game.getInstance().Buttons.FindIndex(f => f.Width == 160);

            if (index == -1)
            {
                Game.getInstance().Buttons.Add(new Button(Game.getInstance().DefaultColor, 320, 170, 160, 50));
                Game.getInstance().Buttons.Add(new Button(Game.getInstance().DefaultColor, 320, 245, 160, 50));
                Game.getInstance().Buttons.Add(new Button(Game.getInstance().DefaultColor, 550, 220, 100, 40));
                Game.getInstance().Buttons.Add(new Button(Game.getInstance().DefaultColor, 550, 270, 100, 40));
                Game.getInstance().Buttons.Add(new Button(Game.getInstance().DefaultColor, 550, 320, 100, 40));
            }
            Game.getInstance().Modifier.Toggle();
            foreach (GameObject o in Game.getInstance().Objects)
            {
                o.Draw();
            }
            foreach (HP o in Game.getInstance().HP)
            {
                o.Draw();
            }
        }
コード例 #12
0
        public override void Draw()
        {
            SplashKit.DrawBitmap(_FishBitmap, X, Y);

            if (Velocity.Y > 0)
            {
                _FishBitmap = new Bitmap("smallJellyfishleft", "./Resources/images/Medium/Jellyfish6.png");
            }
            else
            {
                _FishBitmap = new Bitmap("smallJellyfishright", "./Resources/images/Medium/Jellyfish3.png");
            }
        }
コード例 #13
0
        public override void Draw()
        {
            SplashKit.DrawBitmap(_FishBitmap, X, Y);

            if (Velocity.Y > 0)
            {
                _FishBitmap = new Bitmap("Predetorleft", "./Resources/images/Small/Predator 1 left.png");
            }
            else
            {
                _FishBitmap = new Bitmap("Predetorright", "./Resources/images/Small/Predator 1 right.png");
            }
        }
コード例 #14
0
ファイル: Enemy.cs プロジェクト: fyfie2810/RPGBattleGame
    public override void Draw()
    {
        _HealthPercent = (double)_Health / _MaxHealth;

        SplashKit.DrawBitmap(_Image, 800 - _Image.Width - _ImageBuffer, _ImageBuffer);
        SplashKit.FillRectangle(Color.DarkBlue, BoxOuterBuffer, BoxOuterBuffer, BoxWidth, BoxHeight);
        SplashKit.DrawRectangle(Color.White, BoxOuterBuffer, BoxOuterBuffer, BoxWidth, BoxHeight);
        SplashKit.DrawText($"{_Name} ", Color.White, MainFont, 40, BoxOuterBuffer + BoxInnerBuffer, BoxOuterBuffer + BoxInnerBuffer);
        SplashKit.DrawText($"Lv: {_Level} ", Color.White, MainFont, 40, BoxOuterBuffer + BoxWidth / 2 + 50, BoxInnerBuffer + BoxOuterBuffer);
        SplashKit.DrawText($"HP:", Color.White, MainFont, 40, BoxOuterBuffer + BoxInnerBuffer, BoxOuterBuffer + BoxInnerBuffer + 40);
        SplashKit.FillRectangle(Color.Red, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, _HealthPercent * HealthBarWidth, HealthBarHeight);
        SplashKit.DrawRectangle(Color.White, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, BoxWidth - 2 * BoxInnerBuffer - 2 * BoxOuterBuffer, HealthBarHeight);
    }
コード例 #15
0
        public override void Draw()
        {
            SplashKit.DrawBitmap(_FishBitmap, X, Y);

            if (Velocity.Y > 0)
            {
                _FishBitmap = new Bitmap("Snapperleft", "./Resources/images/Small/Guppy Small Normal left.png");
            }
            else
            {
                _FishBitmap = new Bitmap("Snapperright", "./Resources/images/Small/Guppy Small Normal right.png");
            }
        }
コード例 #16
0
    public void DrawHearts(int numberOfHearts)
    {
        int heartX = 0;

        for (int i = 0; i < numberOfHearts; i++)
        {
            if (heartX < 300)
            {
                SplashKit.DrawBitmap(HeartBitmap, heartX, 0);
                heartX = heartX + 40;
            }
        }
    }
コード例 #17
0
        public override void Draw()
        {
            SplashKit.DrawBitmap(_FishBitmap, X, Y);

            if (Velocity.Y > 0)
            {
                _FishBitmap = new Bitmap("BigPredetorLeft", "./Resources/images/Large/Predator 1 Right.png");
            }
            else
            {
                _FishBitmap = new Bitmap("BigPredetorRight", "./Resources/images/Large/Predator 1 Left.png");
            }
        }
コード例 #18
0
    public void DrawBackground()
    {
        SplashKit.LoadBitmap("background", "42.jpg");
        //Bitmap background = new Bitmap("background",0,0);
        Bitmap background;

        background = SplashKit.BitmapNamed("background");

        SplashKit.DrawBitmap("background", 0, 0);
        SplashKit.DrawBitmap("background", _gameWindow.Width - background.Width, 0);
        SplashKit.DrawBitmap("background", 0, _gameWindow.Height - background.Height);
        SplashKit.DrawBitmap("background", _gameWindow.Width - background.Width, _gameWindow.Height - background.Height);
        SplashKit.DrawBitmap("background", (_gameWindow.Width - background.Width) / 2, (_gameWindow.Height - background.Height) / 2);
    }
コード例 #19
0
        public void Menu()
        {
            string        filePath = @"Resources/txtfiles/menu.txt";
            List <string> menu     = File.ReadAllLines(filePath).ToList();

            foreach (string line in menu)
            {
                string[] entries = line.Split(',');
                string   name    = entries[0];
                int      x       = int.Parse(entries[1]);
                int      y       = int.Parse(entries[2]);
                SplashKit.DrawBitmap(SplashKit.BitmapNamed(name), x, y);
            }
        }
コード例 #20
0
    public void UpdateBalance(Load user)
    {
        int textWidth, balanceWidth;

        Bitmap BetBG = new Bitmap("BetAmountBG", "BetAmountBG.jpg");

        balanceWidth = SplashKit.TextWidth($"${user.balance()}", "BN.ttf", 24);
        SplashKit.DrawBitmap("BetAmountBG", RouletteDependencies.BoardXOffset + 259, RouletteDependencies.BoardYOffset + 354);
        SplashKit.DrawText($"${user.balance()}", Color.White, "BN.ttf", 24, RouletteDependencies.BoardXOffset + 257 + ((192 - balanceWidth) / 2), RouletteDependencies.BoardYOffset + 354);

        textWidth = SplashKit.TextWidth($"${Load.BetAmount}", "BN.ttf", 24);
        SplashKit.DrawBitmap("BetAmountBG", RouletteDependencies.BoardXOffset + 259, RouletteDependencies.BoardYOffset + 300);
        SplashKit.DrawText($"${Load.BetAmount}", Color.White, "BN.ttf", 24, RouletteDependencies.BoardXOffset + 257 + ((192 - textWidth) / 2), RouletteDependencies.BoardYOffset + 300);
        _window.Refresh();
    }
コード例 #21
0
    public Robotdodge(Window gameWindow)
    {
        _gameWindow = gameWindow;

        SplashKit.DrawBitmap("42.jpg", 0, 0);
        // BackGroundMusic backGroundMusic = new BackGroundMusic(_gameWindow);
        // backGroundMusic.Play();

        // RandomBot(gameWindow);

        //moved out of main
        Player Player = new Player(gameWindow);

        _player = Player;
        //SplashKit.Delay(4000);
    }
コード例 #22
0
ファイル: Frogger.cs プロジェクト: AndyManettas/Frogger
        // reset button giving player the option to play again with 3 lives
        public void PlayAgain()
        {
            Bitmap reset = SplashKit.BitmapNamed("reset");

            SplashKit.DrawBitmap(reset, 240, 650);

            if (SplashKit.MouseClicked(MouseButton.LeftButton))
            {
                if (SplashKit.MousePosition().X > 240 && SplashKit.MousePosition().X < 460)
                {
                    if (SplashKit.MousePosition().Y > 650 && SplashKit.MousePosition().Y < 750)
                    {
                        _frog = new Frog();
                    }
                }
            }
        }
コード例 #23
0
    public override void Draw()
    {
        SplashKit.DrawBitmap(_Image, X, Y);

        SplashKit.FillRectangle(Color.DarkBlue, BoxX, BoxY, BoxWidth, BoxHeight);
        SplashKit.DrawRectangle(Color.White, BoxX, BoxY, BoxWidth, BoxHeight);

        _HealthPercent = (double)_Health / _MaxHealth;



        SplashKit.DrawText($"{_Name} ", Color.White, MainFont, 40, _GameWindow.Width - BoxWidth - BoxOuterBuffer + BoxInnerBuffer, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + BoxInnerBuffer);
        SplashKit.DrawText($"HP:", Color.White, MainFont, 40, _GameWindow.Width - BoxWidth - BoxOuterBuffer + BoxInnerBuffer, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + BoxInnerBuffer + 40);
        SplashKit.DrawText($"Lv: {_Level}", Color.White, MainFont, 40, _GameWindow.Width - BoxOuterBuffer - BoxWidth / 2 + 50, 3 * _GameWindow.Height / 4 - BoxOuterBuffer - BoxHeight + BoxInnerBuffer);
        SplashKit.FillRectangle(Color.Red, _GameWindow.Width - BoxWidth - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, _HealthPercent * HealthBarWidth, HealthBarHeight);
        SplashKit.DrawRectangle(Color.White, _GameWindow.Width - BoxWidth - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, HealthBarWidth, HealthBarHeight);
    }
コード例 #24
0
ファイル: RobotDodge.cs プロジェクト: Zollz/RobotDodge
    public void Draw()
    {
        _GameWindow.Clear(Color.White);

        foreach (Robot robot in _Robot)
        {
            robot.Draw();
        }

        for (int i = 1; i <= Lives; i++)
        {
            SplashKit.DrawBitmap(Life, 600 - (i * 50), 50);
        }
        SplashKit.DrawTextOnWindow(_GameWindow, Convert.ToString(_Score.Ticks / 1000), Color.Black, 50, 50);
        _Player.Draw();
        _GameWindow.Refresh(60);
    }
コード例 #25
0
ファイル: Frogger.cs プロジェクト: AndyManettas/Frogger
        // tracks game according to frogs life state
        public void FrogState()
        {
            // frog icons representing lives in bottom left corner
            for (int i = 0, x = 30; i < _frog.Lives; i++, x += 60)
            {
                SplashKit.DrawBitmap(SplashKit.BitmapNamed("frogicon"), x, 755);
            }

            // frog will be drawn as long as it has lives otherwise game will be over
            if (_frog.Lives > 0)
            {
                _frog.Draw();
            }
            else
            {
                Loses();
            }
        }
コード例 #26
0
        public void Environment()
        {
            SplashKit.FillRectangle(Color.Black, 25, 750, 650, 50);
            SplashKit.FillRectangle(Color.Black, 25, 450, 650, 250);
            SplashKit.FillRectangle(SplashKit.RGBColor(4, 0, 66), 25, 0, 650, 400);

            string        filePath    = @"Resources/txtfiles/environment.txt";
            List <string> environment = File.ReadAllLines(filePath).ToList();

            for (int i = 25; i < 675; i += 50)
            {
                foreach (string line in environment)
                {
                    string[] entries = line.Split(',');
                    string   name    = entries[0];
                    int      x       = int.Parse(entries[1]);
                    SplashKit.DrawBitmap(SplashKit.BitmapNamed(name), i, x);
                }
            }
        }
コード例 #27
0
        public void Draw()
        {
            SplashKit.ClearScreen();
            SplashKit.DrawBitmap("Background", 0, 0);
            foreach (GameObject o in Objects)
            {
                o.Draw();
            }
            if (HP.Count > 0)
            {
                for (int i = 0; i < HP.Count; i++)
                {
                    if (HP[i].Hit)
                    {
                        HP.Remove(HP[i]);
                    }
                    else
                    {
                        HP[i].Draw();
                    }
                }
            }
            if (HitObjects.Count > 0)
            {
                for (int i = 0; i < HitObjects.Count; i++)
                {
                    if (HitObjects[i].Y >= SplashKit.ScreenHeight() || HitObjects[i].Hit)
                    {
                        HitObjects.Remove(HitObjects[i]);
                    }
                    else
                    {
                        HitObjects[i].Draw();
                    }
                }
            }

            Player.Draw();
            Modifier.drawScore();
            ProgressBar();
        }
コード例 #28
0
        public void Display()
        {
            Game.getInstance().Timer.Pause();
            SplashKit.PauseMusic();
            SplashKit.ProcessEvents();
            SplashKit.ClearScreen();
            SplashKit.DrawBitmap("Background", 0, 0);
            Game.getInstance().ProgressBar();
            Game.getInstance().DisplayText.Clear();
            if (!startup)
            {
                Game.getInstance().Buttons.Clear();
                Game.getInstance().ButtonColor.Clear();
                Game.getInstance().ButtonColor.AddRange(Enumerable.Repeat(Game.getInstance().DefaultColor, 3));
                startup = true;
            }
            Game.getInstance().DisplayText.Add(new Text("Game Over", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 40, 275, 110));
            Game.getInstance().DisplayText.Add(new Text("Retry", Game.getInstance().ButtonColor[0], Game.getInstance().DefaultFont, 35, 340, 175));
            Game.getInstance().DisplayText.Add(new Text("Exit", Game.getInstance().ButtonColor[1], Game.getInstance().DefaultFont, 35, 355, 250));
            Game.getInstance().Player.Draw();
            Game.getInstance().Modifier.drawScore();
            int index = Game.getInstance().Buttons.FindIndex(f => f.Width == 160);

            if (index == -1)
            {
                Game.getInstance().Buttons.Add(new Button(Game.getInstance().DefaultColor, 320, 170, 160, 50));
                Game.getInstance().Buttons.Add(new Button(Game.getInstance().DefaultColor, 320, 245, 160, 50));
            }
            foreach (GameObject o in Game.getInstance().Objects)
            {
                o.Draw();
            }
            foreach (HP o in Game.getInstance().HP)
            {
                o.Draw();
            }
            foreach (GameObject o in Game.getInstance().HitObjects)
            {
                o.Draw();
            }
        }
コード例 #29
0
 public void Draw()
 {
     _GameWindow.Clear(Color.Black);
     foreach (Robot robot in _Robots)
     {
         robot.Draw();
     }
     _Player.Draw();
     foreach (Bullet bullet in _Bullets)
     {
         bullet.Draw();
     }
     DisplayHUD();
     if (_Player.Lives <= 0)
     {
         _GameWindow.Clear(Color.Black);
         Bitmap _GameOver = new Bitmap("Game Over", "gamover.png");
         SplashKit.DrawBitmap(_GameOver, 200, 100);
         SplashKit.StopMusic();
         SplashKit.PlaySoundEffect("gameover");
     }
     _GameWindow.Refresh(60);
 }
コード例 #30
0
    public void Draw()
    {
        GameWindow.Clear(Color.LightYellow);
        //draw invader, UFO, player plus bullet draws inside the player

        foreach (var item in SuperUFOs)
        {
            item.Draw();
        }
        foreach (var item in CaveBlocks)
        {
            item.Draw();
        }
        foreach (Invader item in Invaders)
        {
            item.Draw();
        }

        foreach (var item in AlienBullets)
        {
            item.Draw();
        }
        Player.Draw(GameWindow);

        SplashKit.DrawBitmap(Title, 50, 50);
        //Text appears on screen
        SplashKit.DrawText($"Lives: {Player.Lives} ", Color.Gray, "cool.ttf", 25, 280, 50);
        SplashKit.DrawText($"Score: {Player.Score}", Color.Gray, "cool.ttf", 25, 280, 85);
        SplashKit.DrawText($"Time: {myTimer.Ticks / 1000}", Color.Gray, "cool.ttf", 25, 200, 130);
        if (Invaders.Count == 0)
        {
            SplashKit.DrawText($"Congradulations! You Win!", Color.OrangeRed, "cool.ttf", 30, 50, 300);
            SplashKit.DrawText($"Your score is {Player.Score}", Color.OrangeRed, "cool.ttf", 30, 50, 260);
        }

        GameWindow.Refresh(60);
    }