Esempio n. 1
0
    public static void Main()
    {
        Window screen = new Window("Deadliner", 800, 600);
        Course course = new Course(screen);

        course.Load();
        screen.Clear(Color.Gray);
        if (!course.HasExecuted)
        {
            course.GetInfoFromUser();
        }

        foreach (Unit unit in course._units)
        {
            if (!unit.HasExecuted)
            {
                unit.GetInfoFromUser();
            }
        }
        Dashboard dashboard = new Dashboard(screen);

        foreach (Unit unit in course._units)
        {
            foreach (Assignment assignment in unit._assignments)
            {
                dashboard.Add(unit, assignment);
            }
        }
        dashboard.Sort();
        dashboard.Show();
        screen.Refresh(60);
        course.Save();
        SplashKit.Delay(2000);
    }
Esempio n. 2
0
 public void isHit(Window gameWindow)
 {
     _obstacleBitmap = new Bitmap("explosion", "explosion.png");
     gameWindow.DrawBitmap(_obstacleBitmap, X, Y);
     gameWindow.Refresh();
     SplashKit.Delay(100);
 }
Esempio n. 3
0
        // This is called when Space key is pressesd.
        public static void TestOnSpace(object sender, OnPathChangedEventArgs onPathChangedEventArgs)
        {
            PathFindingGUI pathFindingGUI = (PathFindingGUI)sender;

            if (onPathChangedEventArgs.pathFinding != null)
            {
                for (int i = 1; i < onPathChangedEventArgs.pathFinding.GetVisitedPath().Count; i++)
                {
                    PathNode searchNode = onPathChangedEventArgs.pathFinding.GetVisitedPath()[i];
                    SplashKit.FillRectangle(Color.LightBlue, searchNode.X * pathFindingGUI.CellSize + 2, searchNode.Y * pathFindingGUI.CellSize + 2, pathFindingGUI.CellSize - 2, pathFindingGUI.CellSize - 2);
                    if (i % 5 == 0)
                    {
                        pathFindingGUI.window.Refresh(60);
                    }
                }
                // If there is no path found, return.
                if (pathFindingGUI.pathNodes == null)
                {
                    return;
                }

                for (int i = 1; i < pathFindingGUI.pathNodes.Count - 1; i++)
                {
                    // Color Green, x is axis of pathNodes[i] in grid * cellSize, y is thr ordinate location of pathNodes[i] in grid * cellSize, with and height = cellSize
                    Util.FillSquare(Color.Yellow, pathFindingGUI.pathNodes[i].X, pathFindingGUI.pathNodes[i].Y, pathFindingGUI.CellSize);
                    pathFindingGUI.window.Refresh(60);
                }
                SplashKit.Delay(5000);
            }
        }
Esempio n. 4
0
    public static void Main()
    {
        Window makeSceneWindow;

        makeSceneWindow = new Window("Make a Scene", 800, 700);

        Bitmap      surya = new Bitmap("surya", "surya.png");
        SoundEffect hello = new SoundEffect("hello", "hello.wav");
        Bitmap      satya = new Bitmap("satya", "satya.png");


        makeSceneWindow.Clear(Color.Green);
        makeSceneWindow.DrawBitmap(surya, 100, 200);
        makeSceneWindow.Refresh(60);

        hello.Play();

        SplashKit.Delay(5000);


        makeSceneWindow.Clear(Color.Green);
        makeSceneWindow.DrawBitmap(satya, 200, 500);
        makeSceneWindow.Refresh(60);

        SplashKit.Delay(6000);
    }
Esempio n. 5
0
    public static void Main(string[] args)
    {
        Window houseWindow;
        Window carWindow;

        // House window Section
        houseWindow = new Window("Shapes by ...", 800, 600);

        houseWindow.Clear(Color.White);
        houseWindow.FillEllipse(Color.BrightGreen, 0, 400, 800, 400);
        houseWindow.FillRectangle(Color.Gray, 300, 300, 200, 200);
        houseWindow.FillTriangle(Color.Red, 250, 300, 400, 150, 550, 300);
        houseWindow.Refresh();

        // Car Window Section
        carWindow = new Window("Car Window", 800, 600);

        carWindow.Clear(Color.LightBlue);
        carWindow.FillRectangle(Color.Red, 150, 300, 500, 200);
        carWindow.FillTriangle(Color.Black, 250, 300, 350, 300, 350, 200);
        carWindow.FillRectangle(Color.Black, 350, 200, 150, 100);
        carWindow.FillTriangle(Color.Black, 500, 300, 500, 200, 550, 300);
        carWindow.FillCircle(Color.Black, 250, 500, 60);
        carWindow.FillCircle(Color.Black, 550, 500, 60);
        carWindow.Refresh();


        SplashKit.Delay(10000);
    }
Esempio n. 6
0
    public static void GameOver(Window w)
    {
        w.Clear(Color.White);
        Bitmap gameover = new Bitmap("Game Over", "game-over.png");

        w.DrawBitmap(gameover, (w.Width - gameover.Width) / 2, (w.Height - gameover.Height) / 2);
        w.Refresh(60);
        SplashKit.Delay(6000);
    }
Esempio n. 7
0
        public static void Main()
        {
            new Window("Snake-Remake", 800, 600);
            double x = 0.0, y = 0.0;
            double speed = 5.0;

            Map   snakeMap = new Map();
            Snake mySnake  = new Snake();

            snakeMap.Add(mySnake);
            Food food = new Food();

            snakeMap.Add(food);

            do
            {
                SplashKit.ProcessEvents();
                SplashKit.ClearScreen(Color.Black);
                mySnake.Update(x, y);
                snakeMap.Draw(x, y);

                if (SplashKit.KeyTyped(KeyCode.UpKey))
                {
                    x = 0;
                    y = -1 * speed;
                }

                if (SplashKit.KeyTyped(KeyCode.DownKey))
                {
                    x = 0;
                    y = speed;
                }

                if (SplashKit.KeyTyped(KeyCode.RightKey))
                {
                    x = speed;
                    y = 0;
                }

                if (SplashKit.KeyTyped(KeyCode.LeftKey))
                {
                    x = -1 * speed;
                    y = 0;
                }

                if (snakeMap.HasCollided(mySnake, food))
                {
                    snakeMap.Collide(mySnake, food, x * 150, y * 150);
                    food = new Food();
                    snakeMap.Add(food);
                }

                SplashKit.Delay(10);
                SplashKit.RefreshScreen();
            } while (!snakeMap.Lose(mySnake) || !SplashKit.WindowCloseRequested("Shape Drawer"));
        }
Esempio n. 8
0
        public static void Main()
        {
            // Variables
            // Window Variables
            Window page1;
            // Sound Effect Variables
            SoundEffect Alert;
            SoundEffect Door;
            SoundEffect Footsteps;
            SoundEffect Sigh;
            // Bitmap Variables
            Bitmap frameOne;
            Bitmap frameTwo;
            Bitmap frameThree;
            Bitmap frameFour;

            // Variable Assignment
            frameOne   = new Bitmap("Frame 1", "1st.png");
            frameTwo   = new Bitmap("Frame 2", "2nd.png");
            frameThree = new Bitmap("Frame 3", "3rd.png");
            frameFour  = new Bitmap("Frame 4", "4th.png");

            Alert     = new SoundEffect("Alert", "iphone_text_message.wav");
            Door      = new SoundEffect("Door", "door squeak.wav");
            Footsteps = new SoundEffect("Footsteps", "running.wav");
            Sigh      = new SoundEffect("Sigh", "sigh.wav");
            // Page Drawing, Sound Effect Playing
            page1 = new Window("Page 1", 800, 800);
            page1.Clear(Color.Black);
            page1.DrawBitmap(frameOne, 80, 80);
            page1.Refresh();
            Alert.Play();

            SplashKit.Delay(5000);

            page1.Clear(Color.Black);
            page1.DrawBitmap(frameTwo, 80, 80);
            page1.Refresh();
            Footsteps.Play();

            SplashKit.Delay(5000);

            page1.Clear(Color.Black);
            page1.DrawBitmap(frameThree, 80, 80);
            page1.Refresh();
            Door.Play();

            SplashKit.Delay(5000);

            page1.Clear(Color.Black);
            page1.DrawBitmap(frameFour, 80, 80);
            page1.Refresh();
            Sigh.Play();

            SplashKit.Delay(5000);
        }
Esempio n. 9
0
    public static void Main()
    {
        Console.WriteLine("hello world");

        Window w = new Window("My First Program", 200, 100);

        w.DrawText("Hello World", Color.Black, 10, 45);
        w.Refresh(60);
        SplashKit.Delay(5000);
    }
Esempio n. 10
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. 11
0
    //procedure to update the list of robots by removing the unwanted robots
    private void CheckCollisions()
    {
        List <Robot> removeRobots = new List <Robot>(); //creating another list to store unwanted robots

        foreach (Robot robot in _Robots)
        {
            //adding robots that collided with the player or are off the screen to second list
            if (_Player.CollidedWith(robot) || robot.IsOffscreen(_GameWindow))
            {
                removeRobots.Add(robot);
            }
            if (_Player.CollidedWith(robot))
            {
                if (robot is Cat1 || robot is Cat2 || robot is Cat3)
                {
                    _GameWindow.DrawText("Avoid Collision", Color.Red, "StencilStd.otf", 100, 400, 300);
                    _GameWindow.Refresh(60);
                    SplashKit.Delay(150);
                }
                else
                {
                    _GameWindow.DrawText("Tasty", Color.Red, "StencilStd.otf", 100, 400, 300);
                    _GameWindow.Refresh(60);
                    SplashKit.Delay(150);
                }
                if (robot is Cat1 || robot is Cat2 || robot is Cat3)
                {
                    if (_LivesRemaining.Count > 1)
                    {
                        _LivesRemaining.RemoveAt(0);
                    }
                    else if (_LivesRemaining.Count == 1)
                    {
                        _LivesRemaining.RemoveAt(0);
                        _GameWindow.Clear(Color.Black);
                        _GameWindow.DrawText("Game Over !!!", Color.Red, "StencilStd.otf", 500, _GameWindow.Width / 2, _GameWindow.Height / 2);
                        _GameWindow.Refresh(60);
                        SplashKit.Delay(4000);
                        _GameWindow.Close();
                    }
                }
                else
                {
                    bonus += 5;
                }
            }
        }
        foreach (Robot robot in removeRobots)
        {
            _Robots.Remove(robot);     //removing robots that are present in second list from 1st list
        }
    }
Esempio n. 12
0
    public static void Main()
    {
        Window ShapesWindow = new Window("window", 800, 600);
        Bitmap BmPlayer     = new Bitmap("Helicopter", "HCS1.png");
        Bitmap BmPlayer2    = new Bitmap("Helicopter2", "HCS2.png");


        BmPlayer.SetCellDetails(132, 36, 5, 1, 5);
        BmPlayer2.SetCellDetails(132, 36, 5, 1, 5);

        AnimationScript FlyScript = SplashKit.LoadAnimationScript("Animation", "Animation.txt");

        Animation Test = FlyScript.CreateAnimation("Fly");

        DrawingOptions opt;

        opt = SplashKit.OptionWithAnimation(Test);

        Helicopter     helicopter = new Helicopter(BmPlayer, BmPlayer2, ShapesWindow, opt);
        HelicopterGame HC         = new HelicopterGame(ShapesWindow, helicopter);

        Test.Assign("Fly");
        HC.StartingScreen();
        Console.WriteLine("Enter current player name");
        HC.PlayerName = Console.ReadLine();
        while (HC.MenuOn)
        {
            SplashKit.ProcessEvents();
            if (SplashKit.MouseClicked(MouseButton.LeftButton))
            {
                HC.MenuOn = false;
            }
            HC.StartingScreen();


            ShapesWindow.Refresh(60);
        }

        while (HC.Quit)
        {
            SplashKit.UpdateAnimation(Test);
            HC.Update();
        }

        ShapesWindow.Close();


        helicopter.Draw();

        ShapesWindow.Refresh(60);
        SplashKit.Delay(4000);
    }
Esempio n. 13
0
 public void CheckHealth()
 {
     if (_player.Health == 0)
     {
         uint _score;
         _gameWindow.DrawText("YOU ARE DEAD", Color.Red, "Bold", 10000000, 400, 300);
         _score = SplashKit.CurrentTicks();
         _gameWindow.DrawText(string.Format("Score: {0}", _score), Color.Black, "Bold", 5000, 400, 200);
         _gameWindow.Refresh(60);
         SplashKit.Delay(3000);
         _gameWindow.Close();
     }
 }
Esempio n. 14
0
        public static void Draw()
        {
            Window gameWindow;

            gameWindow = new Window("Game Window", 500, 500);
            Player Character = new Player(gameWindow);

            gameWindow.Clear(Color.White);
            gameWindow.Refresh(60);
            gameWindow.DrawBitmap(Character.PlayerBitmap, Character.Xcoord, Character.Ycoord);
            gameWindow.Refresh(60);

            SplashKit.Delay(10000);
        }
Esempio n. 15
0
    public void CheckCollisions()
    {
        foreach (Robot a in _robots)
        {
            if (_player.CollidedWith(a) || (a.OffScreen == true))
            {
                _checkCollisions.Add(a);
                System.Console.WriteLine("Collided");
            }

            if (_player.CollidedWith(a))
            {
                // _gameWindow.DrawText("Ouch!", Color.Red, "StencilStd.otf", 100, 400, 300);
                _gameWindow.Refresh(60);
                SplashKit.Delay(150);

                //following if and else if is to stop the list from being negative and causing an error
                //stops life from going below 1
                if (_livesRemaining.Count > 1)
                {
                    _livesRemaining.RemoveAt(0);
                }
                //when it is one after the first if remove only one more life etc..
                else if (_livesRemaining.Count == 1)
                {
                    _livesRemaining.RemoveAt(0);
                    _gameWindow.Clear(Color.Black);
                    _gameWindow.DrawText("GAME OVER", Color.Red, "StencilStd.otf", 97, 100, _gameWindow.Height / 2);
                    _gameWindow.Refresh(60);
                    SplashKit.Delay(4000);
                    _gameWindow.Close();
                    //_gameWindow = null;
                }

                // for (int i = 0; i < _livesRemaining.Count; i++)
                // {
                //     _livesRemaining.RemoveRange(1, 1);
                // }
            }
        }

        foreach (Robot a in _checkCollisions)
        {
            _robots.Remove(a);
        }
    }
Esempio n. 16
0
    public static void Main()
    {
        Window   gameWindow = new Window("Surf Game", 1250, 650);
        SurfGame _game      = new SurfGame(gameWindow);

        while (!gameWindow.CloseRequested && _game.Quit == false)
        {
            SplashKit.ProcessEvents();
            _game.HandleInput();
            _game.Update();
            _game.Draw();
        }

        _game.FinalScore();
        SplashKit.Delay(5000);
        gameWindow.Close();
        gameWindow = null;
    }
Esempio n. 17
0
        private void Draw()
        {
            posY = pos;

            Timer t = new Timer("BG Timer");

            t.Start();
            SplashKit.Delay(100);

            _gameWindow.Clear(Color.Black);
            if (t.Ticks / 1000 < 1)
            {
                pos += 2;
                if (pos == 10)
                {
                    pos = -740;
                    //_gameWindow.DrawBitmap(bg2, posX,posY);
                }
            }
            _gameWindow.DrawBitmap(bg, posX, posY);
            //_gameWindow.DrawBitmap(bg, 0,0);
            _player.Draw();
            foreach (var item in _enemyList)
            {
                item.Draw();
            }
            if (_player.score % 5 == 0)
            {
                //_bossList.Add(new Boss { X = 0 + 350, Y = 50 });
                _bossList.ElementAt(0).Draw();
            }
            // if(_player.score == 10)
            // {
            //     _bossList.Add(new Boss { X = 0 + 250, Y = 50 });

            // }

            //_bossList.ElementAt(0).Draw();

            //_enemy.Draw();
            _gameWindow.Refresh(60);
        }
Esempio n. 18
0
    public static void Main(string[] args)
    {
        Window window;

        window = new Window("ScreenCross", 500, 500);
        ScreenCross screenCross = new ScreenCross(window);
        Timer       myTimer     = new Timer("My Timer");

        myTimer.Start();
        uint score = 10000;

        while (!window.CloseRequested && screenCross.Quit == false && score >= 1)
        {
            score = 10000 - myTimer.Ticks / 1000;

            if (!screenCross.Win() && !screenCross.Lose())
            {
                SplashKit.ProcessEvents();
                screenCross.HandleInput();
                screenCross.Update();
                screenCross.Draw();
                window.DrawText($"Scores: {score}", Color.Gray, 380, 20);
                window.Refresh(1000);
            }
            else if (screenCross.Lose())
            {
                myTimer.Pause();
                window.Clear(Color.White);
                window.DrawText($"Mission failed, your has lost all your lives", Color.Gray, 100, 380);
                window.Refresh(60);
                SplashKit.Delay(1000);
            }
            else
            {
                myTimer.Pause();
                window.Clear(Color.White);
                window.DrawText($"Mission completed, your scores is: {score}", Color.Gray, 100, 380);
                window.Refresh(60);
                SplashKit.Delay(1000);
            }
        }
    }
Esempio n. 19
0
        public void DisplayInfoCheckReady()
        {
            // loop while the use hasn't quit or pressed ready
            while (Input.quit != true && _ready != true)
            {
                // clear the window
                _mainWindow.Clear(Color.White);
                // check for a quit
                Input.CheckQuit();

                // draw everything needed
                _welcomeScreen.Draw();

                // new button press object
                buildToggleButton();

                // check for mouse hover over the ready button, if a mouse over event happens change the btn color to dark green
                _checkReady.button.OnHoverChangeColor();
                _checkReady.button.OnHover += (btn) => _checkReady.button.btnColor = Color.RGBColor(20, 68, 30);

                // refresh window
                _mainWindow.Refresh(5);

                // checks if the user has pressed the ready button, which starts the game
                if (_checkReady.isPressed())
                {
                    // exit while loop
                    _ready = true;
                    // clear window
                    _mainWindow.Clear(Color.White);
                    // remove elements to be drawn
                    _welcomeScreen.removeElements();
                    // refresh
                    _mainWindow.Refresh(5);
                    // delay before jumping in to the main game.
                    SplashKit.Delay(500);
                }
            }
        }
Esempio n. 20
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. 21
0
        public void Run()
        {
            _gameWindow = new Window("BlastOff", 600, 600);

            Draw();
            SplashKit.Delay(2500);

            _player.Move(100, -70);
            Draw();
            SplashKit.Delay(2500);

            _player.Rotate(60);
            Draw();
            SplashKit.Delay(2500);

            _player.Move(100, 0);
            Draw();
            SplashKit.Delay(2500);

            _gameWindow.Close();
            _gameWindow = null;

            SplashKit.Delay(2500);
        }
Esempio n. 22
0
    public static void Main()
    {
        Window     w          = new Window("Player window", 800, 600);
        RobotDodge robotDodge = new RobotDodge(w);
        Timer      timer      = new Timer("My Timer");

        timer.Start();

        while (!w.CloseRequested && !robotDodge.Quit && robotDodge.Lives != 0)
        {
            robotDodge.HandleInput();
            robotDodge.Update(timer);
            robotDodge.Draw();
            SplashKit.Delay(100);
        }

        if (robotDodge.Lives == 0)
        {
            GameOver(w);
        }

        w.Close();
        w = null;
    }
Esempio n. 23
0
    public static void Main()
    {
        //Window object and background bitmap creation
        Window fightWindow = new Window("Ryu Animation3", 640, 480);
        Bitmap background  = new Bitmap("Fight Arena", "BG.png");

        fightWindow.DrawBitmap(background, 0, 0);

        //Animation Bitmap object creation
        Bitmap Ryu1 = new Bitmap("Ryu1", "R1.png");
        Bitmap Ryu2 = new Bitmap("Ryu2", "R2.png");
        Bitmap Ryu3 = new Bitmap("Ryu3", "R3.png");
        Bitmap Ryu4 = new Bitmap("Ryu4", "R4.png");
        Bitmap Ryu5 = new Bitmap("Ryu5", "R5.png");
        Bitmap Ryu6 = new Bitmap("Ryu6", "R6.png");
        Bitmap Ryu7 = new Bitmap("Ryu7", "R7.png");

        //Soundeffect object creation
        SoundEffect shoryuken = new SoundEffect("Shoryuken", "shoryuken.mp3");

        shoryuken.Play();
        SplashKit.Delay(300);

        //Action Sequence
        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu1, 150, 150);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu2, 150, 150);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu3, 150, 150);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu4, 150, 150);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu4, 150, 75);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu4, 150, 50);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu5, 150, 75);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu5, 150, 100);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu6, 150, 150);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu7, 150, 150);
        fightWindow.Refresh();
        SplashKit.Delay(200);

        fightWindow.DrawBitmap(background, 0, 0);
        fightWindow.DrawBitmap(Ryu1, 150, 150);
        fightWindow.Refresh();
        SplashKit.Delay(10000);
    }
Esempio n. 24
0
        public void codeToBreak()
        {
            //create a target that is 4 digits long
            //the distinct method is used to remove any duplicated random numbers
            while (target.Distinct().Count() != SIZE)
            {
                for (int x = 0; x < SIZE; x++)
                {
                    //at the current index set a random number between 0 - 5 (next is used to make sure the number is a postive number and less then 6)
                    target[x] = _rnd.Next(6);
                }
            }
            //start the timer
            gameTime.Start();

            //stores a hint of the target answer
            hint = String.Join("", target);

            //main game logic loop (loops as long as quit isn't true or the user hasn't guessed correctly)
            while (true && Input.quit != true)
            {
                SplashKit.ProcessEvents();

                //check if the user has quit
                Input.CheckQuit();

                //creates a new user guess object, set as the new input guess
                UserGuess takeAPunt = new UserGuess(_gameWindow, _pastGuesses, countCorrect, positionCorrect, attempts);
                _inputGuess = takeAPunt.theUsersGuess; //!! change this to get a user input from the user

                //if the user has asked to quit then quit the game loop
                if (Input.quit)
                {
                    System.Console.WriteLine("quitting");
                    break;
                }
                //add one to attempts
                attempts++;

                //convert the user guess to an int array
                userNumber = _inputGuess.Select(v => v - '0').ToArray();

                //reset the correctness vaildation
                countCorrect    = 0;
                positionCorrect = 0;

                //check the users correctness
                //for each index in the users number
                for (int i = 0; i < SIZE; i++)
                {
                    //if the target contains any of the same numbers as the current index of users number, add to count correct
                    if (target.Contains(userNumber[i]))
                    {
                        countCorrect++;
                    }
                    //if the current index of target is the same as the current index of the users number then add to position correct
                    if (target[i] == userNumber[i])
                    {
                        positionCorrect++;
                    }
                }
                //display if the user guesses the correct code and then quit.
                if (positionCorrect == SIZE)
                {
                    _gameWindow.Clear(Color.White);
                    SplashKit.DrawText($"All Correct!!!, Attempts Taken: {attempts}, Time Taken: {Convert.ToString(totalGameTime.Ticks / 1000)}", Color.Green, "TravelingTypewriter.otf", 30, 130, 200);
                    _gameWindow.Refresh(20);
                    SplashKit.Delay(3000);
                    break;
                }

                //tell the user the correctness for their guess
                System.Console.WriteLine(countCorrect + " correct, ");
                System.Console.WriteLine(positionCorrect + " in the right place. Try again");

                //add the users guess to the list of past guesses
                //used to draw in the past guesses
                //this is where to add in the correctness code if it is to be drawn along side each guess
                _pastGuesses.Add(userNumber);

                //delay before letting the user guess again
                SplashKit.Delay(1000);
            }
        }
Esempio n. 25
0
    public static void Main()
    {
        Window firstWindow;

        firstWindow = new Window("Goku Animation", 400, 400);

        Bitmap sprite1  = new Bitmap("sprite1", "resources/sprite1.png");
        Bitmap sprite2  = new Bitmap("sprite2", "resources/sprite2.png");
        Bitmap sprite3  = new Bitmap("sprite3", "resources/sprite3.png");
        Bitmap sprite4  = new Bitmap("sprite4", "resources/sprite4.png");
        Bitmap sprite5  = new Bitmap("sprite5", "resources/sprite5.png");
        Bitmap sprite6  = new Bitmap("sprite6", "resources/sprite6.png");
        Bitmap sprite7  = new Bitmap("sprite7", "resources/sprite7.png");
        Bitmap sprite8  = new Bitmap("sprite8", "resources/sprite14.png");
        Bitmap sprite9  = new Bitmap("sprite9", "resources/sprite15.png");
        Bitmap sprite10 = new Bitmap("sprite10", "resources/sprite16.png");
        Bitmap sprite11 = new Bitmap("sprite11", "resources/sprite17.png");
        Bitmap sprite12 = new Bitmap("sprite12", "resources/sprite18.png");
        Bitmap sprite13 = new Bitmap("sprite13", "resources/sprite19.png");
        Bitmap sprite14 = new Bitmap("sprite14", "resources/sprite20.png");
        Bitmap sprite15 = new Bitmap("sprite15", "resources/sprite21.png");
        Bitmap sprite16 = new Bitmap("sprite16", "resources/sprite12.png");
        Bitmap sprite17 = new Bitmap("sprite17", "resources/sprite11.png");
        Bitmap sprite18 = new Bitmap("sprite18", "resources/sprite9.png");
        Bitmap sprite19 = new Bitmap("sprite19", "resources/sprite22.png");
        Bitmap sprite20 = new Bitmap("sprite20", "resources/sprite23.png");

        SoundEffect aura       = new SoundEffect("aura", "resources/aura.wav");
        SoundEffect lightning  = new SoundEffect("lightning", "resources/soundeffect1.wav");
        SoundEffect lightning2 = new SoundEffect("lightning2", "resources/soundeffect2.wav");

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite1, 150, 150);
        firstWindow.Refresh(60);


        SplashKit.Delay(2000);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite2, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(5000);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite3, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite4, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        aura.Play();

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite5, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        lightning.Play();

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite6, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite7, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(5000);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite8, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite9, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite10, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(1000);

        aura.Play();

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite11, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(1000);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite12, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(1000);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite13, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(1000);

        lightning2.Play();

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite14, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(6000);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite15, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite16, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite17, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite18, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite19, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(500);

        firstWindow.Clear(Color.White);
        firstWindow.DrawBitmap(sprite20, 150, 150);
        firstWindow.Refresh(60);
        SplashKit.Delay(5000);
    }
Esempio n. 26
0
    public static void DisplayList()
    {
        Bitmap one, two, three, four, five, six, seven, eight, nine, ten, BG, one_behind;

        BG = new Bitmap("PastRollsBG", "PastRollsBG.png");
        SplashKit.DrawBitmap("PastRollsBG", RouletteDependencies.BoardXOffset, RouletteDependencies.BoardYOffset - 70);

        two = new Bitmap(RouletteDependencies.PastRolls[8].ToString(), $"{RouletteDependencies.PastRolls[8]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[8].ToString(), RouletteDependencies.BoardXOffset + 154, RouletteDependencies.BoardYOffset - 60);

        three = new Bitmap(RouletteDependencies.PastRolls[7].ToString(), $"{RouletteDependencies.PastRolls[7]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[7].ToString(), RouletteDependencies.BoardXOffset + 203, RouletteDependencies.BoardYOffset - 60);

        four = new Bitmap(RouletteDependencies.PastRolls[6].ToString(), $"{RouletteDependencies.PastRolls[6]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[6].ToString(), RouletteDependencies.BoardXOffset + 252, RouletteDependencies.BoardYOffset - 60);

        five = new Bitmap(RouletteDependencies.PastRolls[5].ToString(), $"{RouletteDependencies.PastRolls[5]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[5].ToString(), RouletteDependencies.BoardXOffset + 301, RouletteDependencies.BoardYOffset - 60);

        six = new Bitmap(RouletteDependencies.PastRolls[4].ToString(), $"{RouletteDependencies.PastRolls[4]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[4].ToString(), RouletteDependencies.BoardXOffset + 350, RouletteDependencies.BoardYOffset - 60);

        seven = new Bitmap(RouletteDependencies.PastRolls[3].ToString(), $"{RouletteDependencies.PastRolls[3]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[3].ToString(), RouletteDependencies.BoardXOffset + 399, RouletteDependencies.BoardYOffset - 60);

        eight = new Bitmap(RouletteDependencies.PastRolls[2].ToString(), $"{RouletteDependencies.PastRolls[2]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[2].ToString(), RouletteDependencies.BoardXOffset + 448, RouletteDependencies.BoardYOffset - 60);

        nine = new Bitmap(RouletteDependencies.PastRolls[1].ToString(), $"{RouletteDependencies.PastRolls[1]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[1].ToString(), RouletteDependencies.BoardXOffset + 497, RouletteDependencies.BoardYOffset - 60);

        ten = new Bitmap(RouletteDependencies.PastRolls[0].ToString(), $"{RouletteDependencies.PastRolls[0]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[0].ToString(), RouletteDependencies.BoardXOffset + 546, RouletteDependencies.BoardYOffset - 60);

        SplashKit.DrawText("Past Rolls:", Color.White, "BN.ttf", 35, RouletteDependencies.BoardXOffset + 282, RouletteDependencies.BoardYOffset - 111);

        if (isRolled)
        {
            SplashKit.PlaySoundEffect(new SoundEffect("RouletteRoll", "RouletteRoll.mp3"));
            for (int x = 0; x < 20; x++)
            {
                Random rnd = new Random();
                int    num = rnd.Next(0, 36);
                one_behind = new Bitmap("BehindRoller", "BehindRoller.png");
                SplashKit.DrawBitmap("BehindRoller", 137, 62);
                one = new Bitmap(num.ToString(), $"{num}.png");
                SplashKit.DrawBitmap(num.ToString(), RouletteDependencies.BoardXOffset + 105, RouletteDependencies.BoardYOffset - 60);
                _window.Refresh();
                SplashKit.Delay(100 + (20 * Convert.ToUInt32(x)));
                Console.WriteLine(100 + (20 * Convert.ToUInt32(x)));
            }
        }

        one_behind = new Bitmap("BehindRoller", "BehindRoller.png");
        SplashKit.DrawBitmap("BehindRoller", 137, 62);

        one = new Bitmap(RouletteDependencies.PastRolls[9].ToString(), $"{RouletteDependencies.PastRolls[9]}.png");
        SplashKit.DrawBitmap(RouletteDependencies.PastRolls[9].ToString(), RouletteDependencies.BoardXOffset + 105, RouletteDependencies.BoardYOffset - 60);

        isRolled = false;
    }