Esempio n. 1
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();
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
 public void drawScore()
 {
     SplashKit.DrawText(Game.getInstance().Score.ToString(), Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 35, 15, 15);
     SplashKit.DrawText(Game.getInstance().Combo.ToString(), Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 25, Game.getInstance().Player.X + 10, Game.getInstance().Player.Y + 10);
     SplashKit.DrawText($"Lives", Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 25, 360, 420);
     SplashKit.DrawText(Game.getInstance().Lives.ToString(), Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 25, 395, 445);
 }
Esempio n. 4
0
        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();
            }
        }
        /// <summary>
        /// Draws the button on the screen
        /// </summary>
        public override void Draw()
        {
            double midPointY = _y + _height / 2;

            /*
             *  If the button is not active draws it with the normal
             *  color otherwise draws it with the active color
             */
            if (!_active)
            {
                SplashKit.FillRectangle(_color, _x, _y, _width, _height);
            }
            else
            {
                SplashKit.FillRectangle(_activeColor, _x, _y, _width, _height);
            }

            /*
             *  If a caption string has been sets draws that text inside the button
             */
            if (_caption is string)
            {
                SplashKit.DrawText(_caption, _captionColor, _captionFont, _captionSize, _x + 10, midPointY - 10);
            }
        }
Esempio n. 6
0
    public void HandleInput()
    {
        const int SPEED = 5;

        if (SplashKit.KeyDown(KeyCode.RightKey))
        {
            X = X + SPEED;
        }
        else if (SplashKit.KeyDown(KeyCode.LeftKey))
        {
            X = X - SPEED;
        }
        else if (SplashKit.KeyDown(KeyCode.UpKey))
        {
            Y = Y - SPEED;
        }
        else if (SplashKit.KeyDown(KeyCode.DownKey))
        {
            Y = Y + SPEED;
        }
        if (SplashKit.KeyDown(KeyCode.EscapeKey))
        {
            Quit = true;
        }
        if (Lives <= 0)
        {
            SplashKit.ClearScreen(Color.Black);
            SplashKit.DrawText("GAME OVER! ", Color.White, 300, 300);
            //Quit = true;
        }
    }
Esempio n. 7
0
    public void Draw()
    {
        SplashKit.FillCircle(PlayerColor, X, Y, Radius);
        c = SplashKit.CircleAt(X, Y, Radius);

        SplashKit.DrawText(Name, Color.Black, X - Radius, Y - Radius - 10);
    }
Esempio n. 8
0
    public void PrintDialog()
    {
        string scoreText = "Score: " + _score.ToString();
        string timeText  = "Time: " + (SplashKit.TimerTicks(t) / 1000).ToString() + " seconds";

        SplashKit.DrawText(scoreText, Color.Black, 10, 10);
        SplashKit.DrawText(timeText, Color.Black, 10, 30);
    }
Esempio n. 9
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();
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Draws the slider on the screen
        /// </summary>
        public override void Draw()
        {
            double midY = _y + _height / 2;

            // draws the slider caption and the slider's current value
            SplashKit.DrawText($"{_caption} {(int)_sliderValue}", Color.Black, _captionFont, 16, _x, _y);
            SplashKit.FillRectangle(_color, _x, midY - _height / 8, _width, _height / 4);
            _sliderButton.Draw();
        }
Esempio n. 11
0
    public void Draw()
    {
        SplashKit.FillCircle(PlayerColor, X, Y, Radius);
        c = SplashKit.CircleAt(X, Y, Radius);

        SplashKit.DrawText(Name, Color.Black, X - _NameWidth / 2, Y - Radius - 8);
        SplashKit.DrawText(Convert.ToString(Score), Color.Black, X - 3, Y + Radius);

        //SplashKit.DrawText($"X:{X}, Y:{Y}", Color.Black, 5, 20);
    }
Esempio n. 12
0
 public void GameOver()
 {
     if (_score == 10)
     {
         SplashKit.ResetTimer(t);
         SplashKit.FillRectangle(Color.DarkOrange, 200, 150, 400, 300);
         SplashKit.DrawText("Congratultions!", Color.Black, 340, 250);
         SplashKit.DrawText("You caught 10 ducks.", Color.Black, 322, 300);
         SplashKit.DrawText("Your time was " + _score.ToString() + " seconds", Color.Black, 310, 350);
     }
 }
Esempio n. 13
0
 // public void WinEffect(Window win)
 // {
 //   if (IsplayerWin)
 //   {
 //     // WinSound.Play();
 //     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);
 //     win.Refresh(60);
 //   }
 // }
 public void GameOverEffect()
 {
     if (Quit)
     {
         SplashKit.FillRectangle(Color.LightYellow, 0, 200, 600, 700);
         SplashKit.DrawText($"Game Over", Color.OrangeRed, "cool.ttf", 30, 50, 400);
         SplashKit.DrawText($"Your score is {Player.Score}", Color.OrangeRed, "cool.ttf", 30, 50, 260);
         GameWindow.Refresh(60);
         SplashKit.Delay(8000);
     }
 }
Esempio n. 14
0
 public override void Draw()
 {
     SplashKit.FillRectangle(Color, X, Y, Width, Height);
     if (Text == "HP")
     {
         SplashKit.DrawText(Text, Color.White, Game.getInstance().DefaultFont, 15, X + 15, Y + 5);
     }
     else
     {
         SplashKit.DrawText(Text, Color.White, Game.getInstance().DefaultFont, 15, X + 7, Y + 5);
     }
 }
Esempio n. 15
0
    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);
    }
Esempio n. 16
0
        public void Draw()
        {
            _shipBitmap.Draw(_x, _y, SplashKit.OptionRotateBmp(_angle));
            _bullet.Draw();

            for (int i = 0; i < _life; i++)
            {
                // _lifeBitmap.Add(new Bitmap("Life","heart.png"));
                _lifeBitmap[i] = new Bitmap("Life", "heart.png");
                _lifeBitmap[i].Draw(_lifeX + (40 * i), _lifeY);
            }
            SplashKit.DrawText("score : " + score, Color.Red, "Montserrat-Bold", 100, 500, 30);
        }
Esempio n. 17
0
    public void Draw(Box box)
    {
        box.DrawRectangle(Color.Black, rectangle);
        box.DrawText(_label, Color.Black, SplashKit.FontNamed("fontBold"), 18, _x + 5, _y - 20);

        if (IsReading)
        {
            SplashKit.DrawCollectedText(Color.Black, SplashKit.FontNamed("fontThin"), 18, SplashKit.OptionDefaults());
        }
        else
        {
            SplashKit.DrawText(Convert.ToString(value), Color.Black, SplashKit.FontNamed("fontThin"), 18, _x, _y);
        }
    }
Esempio n. 18
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();
    }
Esempio n. 19
0
    public override void Draw(Box box)
    {
        base.Draw(box);

        box.DrawText(label, Color.Black, SplashKit.FontNamed("fontBold"), 16, x + 5, y - 20);

        if (IsReading)
        {
            SplashKit.DrawCollectedText(Color.Black, SplashKit.FontNamed("fontThin"), 18, SplashKit.OptionDefaults());
        }
        else
        {
            SplashKit.DrawText(Convert.ToString(value), Color.Black, SplashKit.FontNamed("fontThin"), 18, x, y);
        }
    }
Esempio n. 20
0
        /// <summary>
        /// Draws the UI buttons and text
        /// </summary>
        public static void DrawUI()
        {
            const int START_X         = 900;
            const int START_Y         = 30;
            const int MARGIN          = 40;
            const int LINE_SPACE      = 20;
            const int TITLE_FONT_SIZE = 32;
            const int TEXT_FONT_SIZE  = 16;

            int  currentX  = START_X;
            int  currentY  = START_Y;
            Font textFont  = new Font("textFont", "resources/Roboto-Regular.ttf");
            Font titleFont = new Font("titleFont", "resources/Roboto-Black.ttf");

            SplashKit.DrawText("Pathfinding Visualizer", Color.Black, titleFont, TITLE_FONT_SIZE, currentX, currentY);
            currentY += MARGIN;

            SplashKit.DrawText("The purpose of this program is to allow you to visualize how", Color.Black, textFont, TEXT_FONT_SIZE, currentX, currentY);
            currentY += LINE_SPACE;
            SplashKit.DrawText("Dijkstra's and A* pathfinding algorithms function.", Color.Black, textFont, TEXT_FONT_SIZE, currentX, currentY);

            currentY += MARGIN;
            SplashKit.DrawText("Set Starting and Ending Cells", Color.Black, titleFont, TEXT_FONT_SIZE, currentX, currentY);

            currentY += LINE_SPACE + 10;
            currentY += MARGIN * 2;
            SplashKit.DrawText("Select Pathfinding Algorithm", Color.Black, titleFont, TEXT_FONT_SIZE, currentX, currentY);
            setStartingPointButton.Draw();
            setEndingPointButton.Draw();

            solveDijiButton.Draw();
            solveAstarButton.Draw();

            currentY += LINE_SPACE + 10;
            currentY += MARGIN * 2;
            SplashKit.DrawText("Select Obstacle Drawing Method", Color.Black, titleFont, TEXT_FONT_SIZE, currentX, currentY);
            drawOptionUserButton.Draw();
            drawOptionRandomButton.Draw();
            drawOptionMazeButton.Draw();

            currentY += LINE_SPACE + 10;
            currentY += MARGIN * 2;
            SplashKit.DrawText("Options", Color.Black, titleFont, TEXT_FONT_SIZE, currentX, currentY);
            clearGridButton.Draw();
            clearPathButton.Draw();
            animationDelaySlider.Draw();
        }
Esempio n. 21
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);
    }
Esempio n. 22
0
    public void DrawInstructions()
    {
        SplashKit.FillRectangle(Color.DarkBlue, _InstructionsX, _InstructionsY, 3 * gameWindow.Width / 4, 3 * gameWindow.Height / 4);
        SplashKit.DrawRectangle(Color.White, _InstructionsX, _InstructionsY, 3 * gameWindow.Width / 4, 3 * gameWindow.Height / 4);
        SplashKit.DrawText($"Welcome to C# Battler", Color.White, _MainFont, 40, _InstructionsX + 20, _InstructionsY);

        SplashKit.DrawText($"Use the menu to navigate", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 2 * _LineHeight);

        SplashKit.DrawText($"The Charge Attack is a mostly accurate but low damage attack", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 4 * _LineHeight);
        SplashKit.DrawText($"The Slash Attack is a semi accurate and high damage attack", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 5 * _LineHeight);
        SplashKit.DrawText($"The Spell Attack is a semi accurate low attack that ignores counters", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 6 * _LineHeight);

        SplashKit.DrawText("A counter is 50% likely to reflect back an attack for half damage", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 8 * _LineHeight);

        SplashKit.DrawText($"You begin with 10 potions which each heal 30 Health", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 10 * _LineHeight);
        SplashKit.DrawText($"A magic heal will heal a random amount relative to your level", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 11 * _LineHeight);
        SplashKit.DrawText("The button labelled Instructions in the top left will toggle this box", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 13 * _LineHeight);
        SplashKit.DrawText("Enjoy!", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 14 * _LineHeight);
    }
Esempio n. 23
0
    //Draw the game
    public void Draw()
    {
        _gameWindow.Clear(Color.Black);
        SplashKit.DrawText(Convert.ToString(Score), Color.White, _font, 25, _gameWindow.Width / 2 - Convert.ToString(Score).Length, 5);
        SplashKit.FillRectangle(Color.White, 0, topBorder - 5, _gameWindow.Width, 5);
        for (int i = 0; i < _Bullets.Count; i++)
        {
            _Bullets[i].Draw();
        }
        SplashKit.DrawText("Bullet: " + Convert.ToString(_Bullets.Count), Color.White, _font, 17, 0, 10);
        string strHighScore = "Top: " + Convert.ToString(HighScore);

        SplashKit.DrawText(strHighScore, Color.White, _font, 17, _gameWindow.Width - 13 * strHighScore.Length, 10);
        for (int i = 0; i < _Boxes.Count; i++)
        {
            _Boxes[i].Draw();
        }
        _player.Draw();
        _gameWindow.Refresh(60);
    }
Esempio n. 24
0
        // called to check where the user is within the limit of guesses
        private void checkAttempts()
        {
            //displays if the user if on their last guess
            if (_numOfGuesses == 11)
            {
                _theGameWindow.Clear(Color.Black);
                SplashKit.DrawText("LAST GUESS!", Color.Red, "TravelingTypewriter.otf", 60, 330, 200);
                _theGameWindow.Refresh(20);
                SplashKit.Delay(1000);
            }

            //user hits a blank screen with the game over text if they have run out of guesses, also gets stuck there until they press quit.
            if (_numOfGuesses == 12)
            {
                while (Input.quit != true)
                {
                    _theGameWindow.Clear(Color.Black);
                    SplashKit.DrawText("GAME OVER!", Color.Red, "TravelingTypewriter.otf", 60, 330, 200);
                    _theGameWindow.Refresh(20);
                    Input.CheckQuit();
                }
            }
        }
Esempio n. 25
0
    // Draw lose screen
    public void DrawLose()
    {
        if (Score > HighScore)
        {
            HighScore = Score;
            // Update database if highScore is changed
            _myDB.RunSql("UPDATE HighScore SET SCORE = " + HighScore + " WHERE NAME = '" + _playerName + "';");
        }

        _gameWindow.Clear(Color.Black);
        string strScore     = "Score: " + Convert.ToString(Score);
        string strHighScore = "High Score: " + Convert.ToString(HighScore);
        string strOption    = "Press Esc to Quit";
        string strOption1   = "Press 1 to Restart";
        string strOption2   = "Press 2: Leader Board";

        SplashKit.DrawText(strScore, Color.White, _font, 25, (_gameWindow.Width / 2) - 6 * strScore.Length, _gameWindow.Height / 2 - 150);
        SplashKit.DrawText(strHighScore, Color.White, _font, 25, (_gameWindow.Width / 2) - 6 * strHighScore.Length, _gameWindow.Height / 2 - 60);
        SplashKit.DrawText(strOption, Color.White, _font, 25, (_gameWindow.Width / 2) - 7 * strOption.Length, _gameWindow.Height / 2 + 30);
        SplashKit.DrawText(strOption1, Color.White, _font, 25, (_gameWindow.Width / 2) - 7 * strOption1.Length, _gameWindow.Height / 2 + 120);
        SplashKit.DrawText(strOption2, Color.White, _font, 25, (_gameWindow.Width / 2) - 7 * strOption2.Length, _gameWindow.Height / 2 + 210);
        _gameWindow.Refresh(60);
    }
Esempio n. 26
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);
    }
Esempio n. 27
0
 public void Loop()
 {
     _countdown = 3;
     _countdownTimer.Start();
     while (_countdown > 0)
     {
         SplashKit.ProcessEvents();
         Game.getInstance().Draw();
         SplashKit.DrawText(_countdown.ToString(), Game.getInstance().DefaultColor, Game.getInstance().DefaultFont, 75, 375, 225);
         SplashKit.RefreshScreen();
     }
     if (_paused)
     {
         Game.getInstance().Timer.Resume();
         SplashKit.ResumeMusic();
     }
     else
     {
         Game.getInstance().Timer.Start();
         SplashKit.PlayMusic("audio");
         SplashKit.SetMusicVolume(0.6f);
     }
     Game.getInstance().SetState(new GameRunning());
 }
Esempio n. 28
0
 public override void Draw() => SplashKit.DrawText(_text, Color, Font, FontSize, X, Y);
Esempio n. 29
0
 public override void Draw()
 {
     SplashKit.DrawText(Value, Color, Font, FontSize, X, Y);
 }
Esempio n. 30
0
 public void Draw()
 {
     SplashKit.FillRectangle(Color.DarkBlue, X, Y, Width, Height);
     SplashKit.DrawRectangle(Color.White, X, Y, Width, Height);
     SplashKit.DrawText(Caption, Color.White, _MainFont, 30, X + 5, Y + 5);
 }