Beispiel #1
0
        public void drawmenu()
        {
            spriteBatch.Begin();
            // Draw menu options
            for (int i = 0; i < numberofoptions; i++)
            {
                if (optionselected == i)
                {
                    menuoptions[i, 1].drawme(ref spriteBatch);
                }
                else
                {
                    menuoptions[i, 0].drawme(ref spriteBatch);
                }
            }

            // Draw mouse
            if (optionselected > -1)
            {
                mousepointer2.rect = mousepointer1.rect;
                mousepointer2.drawme(ref spriteBatch);
            }
            else
            {
                mousepointer1.drawme(ref spriteBatch);
            }

            spriteBatch.End();
        }
Beispiel #2
0
        public void drawgame()
        {
            // Draw the in-game graphics
            sfunctions3d.resetgraphics(GraphicsDevice);
            ground.drawme(gamecamera, false);
            uservehicle.drawme(gamecamera, true);

            for (int i = 0; i < numberoftrees; i++)
            {
                tree[i].drawme(gamecamera, true);
            }

            for (int i = 0; i < ufos.Count(); i++)
            {
                ufos[i].drawme(gamecamera, true);
            }

            spriteBatch.Begin();
            up.drawme(ref spriteBatch);
            down.drawme(ref spriteBatch);
            left.drawme(ref spriteBatch);
            right.drawme(ref spriteBatch);
            left2.drawme(ref spriteBatch);
            right2.drawme(ref spriteBatch);
            if (gameover)
            {
                spriteBatch.DrawString(mainfont, "GAME OVER", new Vector2(130, 100),
                                       Color.White, MathHelper.ToRadians(0), new Vector2(0, 0), 3f, SpriteEffects.None, 0);
            }
            spriteBatch.End();
        }
Beispiel #3
0
        public void drawgame(GameTime gameTime)
        {
            // Draw the in-game graphics
            sfunctions3d.resetgraphics(GraphicsDevice);

            // Draw the ground & walls
            for (int i = 0; i < numberofgrounds; i++)
            {
                ground[i].drawme(gamecamera, false);
            }

            for (int i = 0; i < numberofbullets; i++)
            {
                playerbullet[i].drawme(gamecamera, true);
            }

            for (int i = 0; i < numberofwalls; i++)
            {
                leftwall[i].drawme(gamecamera, false);
                rightwall[i].drawme(gamecamera, false);
            }

            // Draw the robot
            playerchar.drawme(gamecamera, true);

            // Draw the Zombies
            for (int i = 0; i < numberofzombs; i++)
            {
                if (Math.Abs(playerchar.position.Z - zombies[i].position.Z) < 10000)
                {
                    zombies[i].drawme(gamecamera, true);
                }
            }



            DebugShapeRenderer.Draw(gameTime, gamecamera.getview(), gamecamera.getproject());


            spriteBatch.Begin();
            //Draw the arrows for controls
            up.drawme(ref spriteBatch);
            down.drawme(ref spriteBatch);
            left.drawme(ref spriteBatch);
            right.drawme(ref spriteBatch);

            if (bulletcount <= 0)
            {
                firebut.drawme(ref spriteBatch);
            }


            //spriteBatch.DrawString(mainfont, "Res " + displaywidth.ToString() + " " + displayheight.ToString() + " Pos X:" + uservehicle.position.X.ToString("00000") + " Y:" + uservehicle.position.Y.ToString("00000") + " Z:" + uservehicle.position.Z.ToString("00000"),
            //    new Vector2(20, 60), Color.Yellow, MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);

            //spriteBatch.DrawString(mainfont, "Accelerometer X:" + acc.X.ToString("0.00") + " Y:" + acc.Y.ToString("0.00") + " Z:" + acc.Z.ToString("0.00") + " Game Time:" + (gameruntime / 1000).ToString("0"),
            //    new Vector2(20, 80), Color.Yellow, MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);

            spriteBatch.DrawString(mainfont, "Score: " + score.ToString(), new Vector2(625, 10),
                                   Color.LightGreen, MathHelper.ToRadians(0), new Vector2(0, 0), 0.75f, SpriteEffects.None, 0);

            spriteBatch.DrawString(mainfont, "Health: " + health.ToString(), new Vector2(10, 10),
                                   Color.LightGreen, MathHelper.ToRadians(0), new Vector2(0, 0), 0.75f, SpriteEffects.None, 0);


            spriteBatch.DrawString(mainfont, "Survive for as long as possible!", new Vector2((displaywidth / 2) - 200, displayheight - 35),
                                   Color.LightGreen, MathHelper.ToRadians(0), new Vector2(0, 0), 0.75f, SpriteEffects.None, 0);

            if (gameover)
            {
                backgroundGO.drawme(ref spriteBatch);
            }

            spriteBatch.End();
        }