Пример #1
0
        public void UpdateL1(GameTime gameTime)
        {
            ks = Keyboard.GetState();


            yarnBalls.moveDeltaXY();


            // collision test

            for (int i = 0; i < yarnBalls.count(); i++)
            {
                Sprite3 s = yarnBalls.getSprite(i);

                bool coll = playerSprite.collision(s);

                if (coll)
                {
                    kachingSound.playSoundIfOk();
                    s.setActive(false);
                    points++;
                }
            }



            // used to move the kitty cat to the left
            if (ks.IsKeyDown(Keys.Left))
            {
                playerSprite.moveByDeltaXY();
                playerSprite.animationTick(gameTime);
                successSound.playSoundIfOk();
                playerSprite.active = true;
                background.Update(gameTime);
            }

            if (ks.IsKeyDown(Keys.Right))
            {
                // NOTE: the move right functionality does not work currently
                background.Update(gameTime);
            }

            if (ks.IsKeyDown(Keys.B))
            {
                showBB = !showBB;
            }

            /// increases the player's jump speed - this is a secret function
            if (ks.IsKeyDown(Keys.Z))
            {
                playerJumpSpeed++;
            }

            // decreases the player's jump speed - this is another secret function
            if (ks.IsKeyDown(Keys.X))
            {
                playerJumpSpeed--;
            }

            // this gives the small kitty cat the ability to jump around the screen
            if (playerJump)
            {
                playerVec.Y     += playerJumpSpeed;
                playerJumpSpeed += 1;
                playerSprite.setPosY(playerVec.Y);

                if (playerVec.Y >= prevPos.Y)
                {
                    playerSprite.setPosY(prevPos.Y);
                    playerJump = false;
                }
            }
            else
            {
                if (ks.IsKeyDown(Keys.Up))
                {
                    playerJump = true;
                    jumpoSound.playSoundIfOk();
                    playerJumpSpeed = -14;
                    playerSprite.setPosY(playerVec.Y);
                }
            }

            // transition over to level 2
            if (points == 5)
            {
                state = 3;
            }
        }
Пример #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        /// This is a mess, please forgive me
        protected override void Update(GameTime gameTime)
        {
            //Console.WriteLine(enemies.count());
            curPos = horse.getPos();
            bool keyDown = false;

            switch (level)
            {
            case 1:
                horse.setWidthHeight(1568 / 8 * 0.3f, texHorseRun.Height * 0.3f);
                k = Keyboard.GetState();
                if (!started)
                {
                    started = true;
                    StartMovement(8);
                }

                if (k.IsKeyDown(Keys.Down))
                {
                    keyDown = true;
                    horse.setPosY(horse.getPosY() + movementSpeed - 2);
                }

                if (k.IsKeyDown(Keys.Up))
                {
                    keyDown = true;
                    horse.setPosY(horse.getPosY() - movementSpeed + 2);
                }

                if (k.IsKeyDown(Keys.Left))
                {
                    keyDown = true;
                    horse.setFlip(SpriteEffects.FlipHorizontally);
                    horse.setPosX(horse.getPosX() - movementSpeed + 2);
                }

                if (k.IsKeyDown(Keys.Right))
                {
                    keyDown = true;
                    horse.setFlip(SpriteEffects.None);
                    horse.setPosX(horse.getPosX() + movementSpeed - 2);
                }
                if (!keyDown)
                {
                    horse.setAnimationSequence(anim, 0, 7, 0);
                }
                else
                {
                    horse.setAnimationSequence(anim, 0, 7, 8);
                }
                //387 330
                if (curPos.X >= -155 && curPos.X <= -75 && curPos.Y >= 330 && curPos.Y <= 387)
                {
                    horse.setPos(xx, yy);
                    started = false;
                    horse.setFlip(SpriteEffects.None);
                    level = 0;
                }

                horseRun.animationTick(gameTime);
                mainCamera.Follow(horse);

                break;

            default:
                if (!started)
                {
                    if (k.IsKeyDown(Keys.D1) || k.IsKeyDown(Keys.NumPad1))
                    {
                        difficulty = 1;
                    }
                    else if (k.IsKeyDown(Keys.D2) || k.IsKeyDown(Keys.NumPad2))
                    {
                        difficulty = 2;
                    }
                    else if (k.IsKeyDown(Keys.D3) || k.IsKeyDown(Keys.NumPad3))
                    {
                        difficulty = 3;
                    }
                }
                switch (difficulty)
                {
                case 1:
                    difficultyOffset = 1;
                    break;

                case 2:
                    difficultyOffset = 0.5f;
                    break;

                case 3:
                    difficultyOffset = 0.1f;
                    break;

                default:
                    break;
                }
                horse.setWidthHeight(1568 / 8 * 0.5f, texHorseRun.Height * 0.5f);
                //This timer makes basic instructions disappear after 3 seconds
                if (textFadeTimer < 3 && started)
                {
                    textFadeTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
                }
                if (started)
                {
                    enemySpawnTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
                }

                if (enemySpawnTimer > difficultyOffset)
                {
                    enemySpawnTimer = 0;
                    LoadEnemies();
                }

                //Escape key exits game
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                {
                    Exit();
                }

                //Keyboard current and previous state
                prevK = k;
                k     = Keyboard.GetState();

                //Begin all game functionality essentially
                if (k.IsKeyDown(Keys.Enter) && !started)
                {
                    started = true;
                    StartMovement(8);
                }

                if (started)
                {
                    //Bounding box activation key
                    if (k.IsKeyDown(Keys.B) && prevK.IsKeyUp(Keys.B))
                    {
                        showbb = !showbb;
                    }

                    //Game over is a bool that is used to ensure the player can't move horse after it is dead, causes errors otherwise
                    if (!gameOver)
                    {
                        //Player movement down
                        if (k.IsKeyDown(Keys.Down))
                        {
                            if (horseRun.getSprite(0).getPosY() < bot - horse.getHeight())
                            {
                                horseRun.getSprite(0).setPosY(horseRun.getSprite(0).getPosY() + movementSpeed);
                            }
                        }
                        //Player movement up
                        if (k.IsKeyDown(Keys.Up))
                        {
                            if (horseRun.getSprite(0).getPosY() > top)
                            {
                                horseRun.getSprite(0).setPosY(horseRun.getSprite(0).getPosY() - movementSpeed);
                            }
                        }
                    }

                    for (int e = 0; e < enemies.count(); e++)
                    {
                        if (enemies[e].getVisible())
                        {
                            enemies[e].setPosX(enemies[e].getPosX() - enemyMovementSpeed);
                        }
                        if (enemies[e].getPosX() < 0 - texEnemy.Width)
                        {
                            enemies[e].setVisible(false);
                        }
                    }

                    //Collision detection, arrow to enemy
                    for (int ea = 0; ea < quiver.count(); ea++)
                    {
                        int ac = enemies.collisionWithRect(quiver[ea].getBoundingBoxAA());
                        if (ac != -1)
                        {
                            score++;
                            Blood(enemies.getSprite(ac).getPosX(), enemies.getSprite(ac).getPosY(), false);
                            enemies.getSprite(ac).setVisible(false);
                            quiver[ea].setVisible(false);
                            quiver[ea].setPos(new Vector2(0, 0));
                            //LoadEnemies();
                        }
                    }


                    //Allow player to increase or decrease speed
                    if (Keyboard.GetState().IsKeyDown(Keys.Right))
                    {
                        enemyMovementSpeed = fastEnemy;
                        horse.setAnimationSequence(anim, 0, 7, fastPlayer);
                    }
                    else if (Keyboard.GetState().IsKeyDown(Keys.Left))
                    {
                        enemyMovementSpeed = slowEnemy;
                        horse.setAnimationSequence(anim, 0, 7, slowPlayer);
                    }
                    else if (started)
                    {
                        enemyMovementSpeed = normalEnemy;
                        horse.setAnimationSequence(anim, 0, 7, normalPlayer);
                    }

                    //Scrolling background functionality
                    if (scrolling1.rectangle.X + scrolling1.texture.Width <= 0)
                    {
                        scrolling1.rectangle.X = scrolling2.rectangle.X + scrolling2.texture.Width;
                    }
                    if (scrolling2.rectangle.X + scrolling2.texture.Width <= 0)
                    {
                        scrolling2.rectangle.X = scrolling1.rectangle.X + scrolling1.texture.Width;
                    }
                    scrolling1.Update();
                    scrolling2.Update();

                    //Game over is a bool that is used to ensure the player can't move horse after it is dead, causes errors otherwise
                    if (!gameOver)
                    {
                        //Collision detection, enemy to player
                        int rc = enemies.collisionWithRect(horse.getBoundingBoxAA());
                        if (rc != -1)
                        {
                            Blood(horse.getPosX(), horse.getPosY(), true);
                            movementSpeed      = 0;
                            enemyMovementSpeed = 0;
                            scrolling1.speed   = 0;
                            scrolling2.speed   = 0;
                            for (int i = 0; i < horseRun.count(); i++)
                            {
                                horseRun.deleteSprite(i);
                            }
                            gameOver = true;
                        }
                    }

                    //Shooting arrow functionality
                    if (Keyboard.GetState().IsKeyDown(Keys.Space) && !arrowShot)
                    {
                        Arrow();
                        arrowShot = true;
                    }
                    for (int a = 0; a < quiver.count(); a++)
                    {
                        if (quiver[a].getVisible())
                        {
                            quiver[a].savePosition();
                            quiver[a].moveByDeltaXY();
                        }
                        if (quiver[a].getPosX() > 800)
                        {
                            quiver[a].setVisible(false);
                        }
                    }
                    if (arrowShot)
                    {
                        arrowTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
                    }
                    if (arrowTimer > 0.5f)
                    {
                        arrowTimer = 0;
                        arrowShot  = false;
                    }
                }

                //Animation ticks for anything that is being animated
                horseRun.animationTick(gameTime);
                enemies.animationTick(gameTime);
                bloodSplat.animationTick(gameTime);

                if (gameOver)
                {
                    deathTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
                }
                break;
            }
            base.Update(gameTime);
        }
Пример #3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // TODO: Add your update logic here
            InputManager.Instance.Update();



            //deltaTime is in seconds, so calculations = pixels per second.
            deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            //Press enter to start game/level
            if (!startGame)
            {
                if (InputManager.Instance.KeyPressed(Keys.Enter))
                {
                    startGame = true;
                }


                return;
            }

            timer += deltaTime;

            //update player
            spritePlayer.Update(gameTime);

            //update backgrounds
            scrollBack.Update(gameTime);
            scrollFore.Update(gameTime);
            scrollBack.setScrollSpeed(playerSpeeeeeed - 2);
            scrollFore.setScrollSpeed(playerSpeeeeeed);

            //limit scroll speed
            if (playerSpeeeeeed > -1)
            {
                playerSpeeeeeed = -1;
            }
            else if (playerSpeeeeeed < -10)
            {
                playerSpeeeeeed = -10;
            }

            //Every 2 seconds, spawn an enemy randomly.
            if (timer > spawnInterval)
            {
                AddEnemy(enemyList);
                timer = 0;
            }

            //inputs
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            if (InputManager.Instance.KeyPressed(Keys.B))
            {
                showbb = !showbb;
            }

            //PLAYER MOVEMENT
            if (InputManager.Instance.KeyDown(Keys.Left))
            {
                if (spritePlayer.getPosX() > playArea.Left)
                {
                    spritePlayer.setPosX(spritePlayer.getPosX() - playerSpeed);
                }
                playerSpeeeeeed += 0.1f;
            }
            if (InputManager.Instance.KeyDown(Keys.Right))
            {
                if (spritePlayer.getPosX() < playArea.Right - spritePlayer.getWidth())
                {
                    spritePlayer.setPosX(spritePlayer.getPosX() + playerSpeed);
                }
                playerSpeeeeeed += -0.1f;
            }
            if (InputManager.Instance.KeyDown(Keys.Up))
            {
                if (spritePlayer.getPosY() > playArea.Bottom)
                {
                    spritePlayer.setPosY(spritePlayer.getPosY() - playerSpeed);
                }
            }
            if (InputManager.Instance.KeyDown(Keys.Down))
            {
                if (spritePlayer.getPosY() < playArea.Top - spritePlayer.getHeight())
                {
                    spritePlayer.setPosY(spritePlayer.getPosY() + playerSpeed);
                }
            }
            //PLAYER SHOOT
            if (InputManager.Instance.KeyPressed(Keys.Space))
            {
                AddBullet((int)spritePlayer.getPosX(), (int)spritePlayer.getPosY());
            }

            //Update all enemies and bullets to move. also inactive if outofbounds
            //In the past I called this instead of having an extended class with custom update
            // enemyList.moveDeltaX(-3);


            //Update/remove enemies
            enemyList.Update(gameTime);
            enemyList.removeIfOutside(new Rectangle(-100, -100, SCREEN_WIDTH + 200, SCREEN_HEIGHT + 200));

            //update/remove bullets
            playerBulletList.moveDeltaX(5);
            playerBulletList.removeIfOutside(new Rectangle(-100, -100, SCREEN_WIDTH + 200, SCREEN_HEIGHT + 200));



            //If player collides with enemy
            int collisionIndex = enemyList.collisionAA(spritePlayer);

            if (collisionIndex != -1)
            {
                Sprite3 temp = enemyList.getSprite(collisionIndex);
                //player collides with boss
                if (temp.getName() == "boss")
                {
                }
                else
                {
                    //enemy dies?
                    temp.active  = false;
                    temp.visible = false;
                    AddExplosion((int)temp.getPosX(), (int)temp.getPosY());
                    score         -= 5;
                    textScore.text = "Score : " + score.ToString();
                }
            }

            //if a bullet collides with enemy
            for (int i = 0; i < playerBulletList.count(); i++)
            {
                Sprite3 currentBullet = playerBulletList.getSprite(i);
                if (currentBullet == null)
                {
                    continue;
                }
                if (currentBullet.active != true)
                {
                    continue;
                }
                if (currentBullet.visible != true)
                {
                    continue;
                }

                //if collision success
                int collision = enemyList.collisionAA(currentBullet);
                if (collision != -1)
                {
                    Sprite3 currentEnemy = enemyList.getSprite(collision);

                    //kill both enemy and bullet
                    currentEnemy.active   = false;
                    currentEnemy.visible  = false;
                    currentBullet.active  = false;
                    currentBullet.visible = false;

                    //add particle
                    AddExplosion((int)currentEnemy.getPosX(), (int)currentEnemy.getPosY());

                    //add score
                    score         += 10;
                    textScore.text = "Score : " + score.ToString();
                }
            }

            //update particles
            particleList.animationTick(gameTime);



            base.Update(gameTime);
        }
Пример #4
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // TODO: Add your update logic here
            prevK = k;
            k     = Keyboard.GetState();

            delTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            redTimer += delTime;

            timer += delTime;



            if ((timer > (float)spawnTimer))
            {
                NewEnemy(enemyXX, bot - texEnemy.Height);
                timer = 0;
            }



            back1.Update(gameTime);
            grass1.Update(gameTime);



            //player collision
            int plCol = enemyList.collisionAA(paddle);



            if (plCol != -1)
            {
                Sprite3 temp = enemyList.getSprite(plCol);
                createExplosion((int)temp.getPosX(), (int)temp.getPosY());
                temp.active  = false;
                temp.visible = false;
                score       += 1;

                if (spawnTimer > 1)
                {
                    spawnTimer -= 1;
                }

                else
                {
                    spawnTimer = 1;
                }
            }

            for (int j = 0; j < enemyList.count(); j++)
            {
                Sprite3 currentEnemy = enemyList.getSprite(j);

                currentEnemy.varInt0 += delTime;
                float prevPosX = currentEnemy.getPosX();
                if (currentEnemy.varInt0 > 0.2f)
                {
                    currentEnemy.setColor(Color.White);
                    //redTimer = 0;
                    currentEnemy.setPosX(prevPosX);
                    currentEnemy.varInt0 = 0;
                }
            }


            for (int i = 0; i < ballList.count(); i++)
            {
                Sprite3 tempBullet    = ballList.getSprite(i);
                int     enemyCollided = enemyList.collisionAA(tempBullet);



                if (enemyCollided != -1)
                {
                    Sprite3 tempEnemy = enemyList.getSprite(enemyCollided);

                    tempBullet.active  = false;
                    tempBullet.visible = false;


                    tempEnemy.setColor(Color.Red);
                    tempEnemy.setPosX(tempEnemy.getPosX() + 10);



                    tempEnemy.hitPoints -= 1;



                    if (tempEnemy.hitPoints < 1)
                    {
                        createExplosion((int)tempBullet.getPosX(), (int)tempBullet.getPosY());
                        tempEnemy.active  = false;
                        tempEnemy.visible = false;
                        score            += 1;

                        if (spawnTimer > 1)
                        {
                            spawnTimer -= 1;
                        }

                        else
                        {
                            spawnTimer = 1;
                        }
                    }
                }
            }



            enemyList.moveDeltaXY();
            enemyList.removeIfOutside(playArea);
            ballList.moveDeltaXY();
            ballList.removeIfOutside(playArea);



            if (k.IsKeyDown(Keys.Left))
            {
                scrollSpeed = 0.5f;
                back1.setScrollSpeed(scrollSpeed);
                grass1.setScrollSpeed(1);
            }


            if (k.IsKeyDown(Keys.Up))
            {
                if (paddle.getPosY() > top + 1)
                {
                    paddle.setPosY(paddle.getPosY() - paddleSpeed);
                }
            }

            else if (k.IsKeyDown(Keys.Down))
            {
                //if (paddle.getPosY() < ((bot- top) - (texpaddle.Height + 2))) paddle.setPosY(paddle.getPosY() + paddleSpeed);
                if (paddle.getPosY() <= playArea.Height - texpaddle.Height + 7)
                {
                    paddle.setPosY(paddle.getPosY() + paddleSpeed);
                }
            }

            else if (k.IsKeyDown(Keys.Right))
            {
                scrollSpeed = -1;
                back1.setScrollSpeed(scrollSpeed);
                grass1.setScrollSpeed(-30);
            }
            else if (k.IsKeyDown(Keys.Left))
            {
                scrollSpeed = 0.5f;
                back1.setScrollSpeed(scrollSpeed);
                grass1.setScrollSpeed(1);
            }



            if (k.IsKeyDown(Keys.Space) && prevK.IsKeyUp(Keys.Space))
            {
                NewBall(xx, yy);
            }
            if (k.IsKeyDown(Keys.B) && prevK.IsKeyUp(Keys.B)) // ***
            {
                showbb = !showbb;
            }



            booms.animationTick(gameTime);
            base.Update(gameTime);
        }
Пример #5
0
        public override void Draw(GameTime gameTime)
        {
            if (score >= 1000)
            {
                status = "THE END!";
            }
            else if (player.hitPoints == 0)
            {
                status = "YOU DEAD!";
            }
            else
            {
                status = "Missile Left: " + missileCount;
            }

            spriteBatch.Begin();

            backgroundLevel2.Draw(spriteBatch);
            spriteBatch.DrawString(scoreFont, "Score: " + score + "/1000", new Vector2(20, 20), Color.Black); // Draw Score on top left
            spriteBatch.DrawString(scoreFont, status, new Vector2(1100, 20), Color.Black);                    // Draw missile count
            spriteBatch.Draw(texMouse, new Rectangle((int)mouse_x, (int)mouse_y, 16, 16), Color.White);       // draw the mouse here
            enemy1.Draw(spriteBatch);
            enemy2.Draw(spriteBatch);
            player.Draw(spriteBatch);
            missileSmoke.Draw(spriteBatch);

            if (timer > 300)
            {
                life.setActiveAndVisible(true);
                life.draw(spriteBatch);
            }

            // If certain conditions are met, then draw these weapons
            if (drawMissile == true && missileCount != 0)
            {
                missile.draw(spriteBatch);
                missile.setPosY(missile.getPosY() - 3);
                missileSmoke.sysPos = new Vector2(missile.getPosX() + missile.getWidth() / 2, missile.getPosY() + missile.getHeight());
            }

            if (anchorDraw == true)
            {
                anchor.setActiveAndVisible(true);
                anchor.draw(spriteBatch);
                anchor.setPosY(anchor.getPosY() + 4);
            }

            if (drawMines && mineCount == 1)
            {
                mine.setPos(minePos.X, minePos.Y);
                mine.draw(spriteBatch);
            }

            // If there is a collision, draw explosion animation
            if (collision1 == true)
            {
                drawMissile = false;
                drawExplosion(currXMissile, currYMissile);
                enemy1.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700));
                if (explostionTimer == 100)
                {
                    collision1      = false;
                    score          += 50;
                    explostionTimer = 0;
                }
            }
            if (collision2 == true)
            {
                drawMissile = false;
                drawExplosion(currXMissile, currYMissile);
                enemy2.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700));
                if (explostionTimer == 80)
                {
                    score          += 100;
                    collision2      = false;
                    explostionTimer = 0;
                    missileSmoke.deActivate();
                }
            }

            if (mineCollisionToggle == true)
            {
                mineCollission = false;
                mineExplostionAnimation.setPos(mineCurrPos.X - mine.getWidth() / 2, mineCurrPos.Y - mine.getHeight() / 2);
                mineExplostionAnimation.draw(spriteBatch);
                if (explostionTimer == 100)
                {
                    mineExplostionAnimation.makeInactive = true;
                    enemy1.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700));
                    mineCollisionToggle = false;
                    explostionTimer     = 0;
                }
            }
            if (mineCollisionToggle2 == true)
            {
                mineCollission2 = false;
                mineExplostionAnimation.setPos(mineCurrPos.X - mine.getWidth() / 2, mineCurrPos.Y - mine.getHeight() / 2);
                mineExplostionAnimation.draw(spriteBatch);
                if (explostionTimer == 100)
                {
                    mineExplostionAnimation.makeInactive = true;
                    enemy2.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700));
                    mineCollisionToggle2 = false;
                    explostionTimer      = 0;
                }
            }
            // Draw BB
            if (showBB)
            {
                player.drawInfo(spriteBatch, Color.White, Color.Yellow);
                enemy1.drawInfo(spriteBatch, Color.White, Color.Yellow);
                enemy2.drawInfo(spriteBatch, Color.White, Color.Yellow);;
                missile.drawInfo(spriteBatch, Color.White, Color.Yellow);
                life.drawInfo(spriteBatch, Color.White, Color.Yellow);
                mine.drawInfo(spriteBatch, Color.White, Color.Yellow);
                anchor.drawInfo(spriteBatch, Color.White, Color.Yellow);
                //weaponList.drawInfo(spriteBatch, Color.White, Color.Yellow);
            }
            spriteBatch.End();
        }
Пример #6
0
        public override void Draw(GameTime gameTime)
        {
            if (score >= 300)
            {
                status = "NEXT LEVEL!";
            }
            else
            {
                status = "Missile Left: " + missileCount;
            }

            graphicsDevice.Clear(Color.Aqua);
            spriteBatch.Begin();

            Dir.background.Draw(spriteBatch);
            player.draw(spriteBatch);

            enemyList.Draw(spriteBatch);
            missileSmoke.Draw(spriteBatch);
            spriteBatch.DrawString(scoreFont, "Score: " + score + "/300", new Vector2(20, 20), Color.Black); // Draw Score on top left
            spriteBatch.DrawString(scoreFont, status, new Vector2(1100, 20), Color.Black);                   // Draw missile count

            if (drawMissile == true && missileCount != 0)
            {
                missile.draw(spriteBatch);
                missile.setPosY(missile.getPosY() - 3);
                missileSmoke.sysPos = new Vector2(missile.getPosX() + missile.getWidth() / 2, missile.getPosY() + missile.getHeight());
            }

            if (collision1 == true)
            {
                drawMissile = false;
                drawExplosion(currXMissile, currYMissile);
                enemy1.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700));
                if (explostionTimer == 110)
                {
                    collision1      = false;
                    score          += 50;
                    explostionTimer = 0;
                    missileSmoke.deActivate();
                }
            }
            if (collision2 == true)
            {
                drawMissile = false;
                drawExplosion(currXMissile, currYMissile);
                enemy2.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700));
                if (explostionTimer == 80)
                {
                    score          += 100;
                    collision2      = false;
                    explostionTimer = 0;
                    missileSmoke.deActivate();
                }
            }
            if (collision3 == true)
            {
                drawMissile = false;
                drawExplosion(currXMissile, currYMissile);
                enemy3.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700));
                if (explostionTimer == 80)
                {
                    score          += 50;
                    collision3      = false;
                    explostionTimer = 0;
                    missileSmoke.deActivate();
                }
            }

            if (showBoundary)
            {
                //LineBatch.drawLineRectangle(spriteBatch, new Rectangle(1, 0, rightBoundary+4, bottomBoundary), Color.Blue);
                player.drawInfo(spriteBatch, Color.Yellow, Color.Red);
                missile.drawInfo(spriteBatch, Color.Black, Color.Red);
                enemyList.drawInfo(spriteBatch, Color.Yellow, Color.Purple);
            }
            spriteBatch.End();
        }