Ejemplo n.º 1
0
 public Actor()
 {
     theMaster = Master.theMaster;
     theRenderman = theMaster.Renderer;
     if (moveSpeed == 0)
     moveSpeed = radius = density = width = height = 10f;
 }
Ejemplo n.º 2
0
        public void drawLeaderboard(Game1 cGame, Master cScore)
        {
            Start = "Start Game";
            Quit = "Exit Game";

            cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            cGame.spriteBatch.DrawString(Arial, Start, new Vector2(400.0f, 200.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B));
            cGame.spriteBatch.DrawString(Arial, Quit, new Vector2(400.0f, 400.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B));
            cGame.spriteBatch.End();
    }
Ejemplo n.º 3
0
        public void Draw(Game1 cGame, Master cScore)
        {
            update();

            cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied);
            cGame.spriteBatch.Draw(backgroundImg, new Vector2(0, 0), Color.White);
            cGame.spriteBatch.End();

            player1Score = "Player 1 Score: " + cScore.returnScore[0];
            player2Score = "Player 2 Score: " + cScore.returnScore[1];
            cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            cGame.spriteBatch.DrawString(Arial, player1Score, new Vector2(325.0f, 300.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B));
            cGame.spriteBatch.DrawString(Arial, player2Score, new Vector2(325.0f, 320.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B));
            cGame.spriteBatch.End();
        }
        public void drawLeaderboard(Game1 cGame, GameTime gameTime, Master cScore, int CircleCount, int NeutralCount, int SquareCount, int maxEnemyNumber)
        {
            if (!doOnce)
            {
                gTimeSeconds = gameTime.TotalGameTime.TotalSeconds;
                gTimeMinutes = gameTime.TotalGameTime.TotalMinutes;
                countDownSecs = 60;
                countDownMins = cScore.GameTimeLeft - 1;
                doOnce = true;
            }
            if (gTimeSeconds + 1 < gameTime.TotalGameTime.TotalSeconds)
            {
                if (countDownSecs <= 0 && countDownMins >= 0)
                    countDownSecs = 60;
                else if (countDownSecs > 0)
                    countDownSecs--;
                gTimeSeconds = gameTime.TotalGameTime.TotalSeconds;
            }
            if (gTimeMinutes + 1 < gameTime.TotalGameTime.TotalMinutes)
            {
                countDownMins--;
                gTimeMinutes = gameTime.TotalGameTime.TotalMinutes;
            }
            cScore.GameTimeLeft = countDownMins;

            if (countDownMins < 10 && countDownSecs < 10)
                gameTimer = "Time Left: 0" + countDownMins + ":0" + countDownSecs;
            else if (countDownMins < 10)
                gameTimer = "Time Left: 0" + countDownMins + ":" + countDownSecs;
            else if (countDownSecs < 10)
                gameTimer = "Time Left: " + countDownMins + ":0" + countDownSecs;
            else
                gameTimer = "Time Left: " + countDownMins + ":" + countDownSecs;

            player1Score = "Square Score: " + cScore.returnScore[0];
            player2Score = "Circle Score: " + cScore.returnScore[1];
            //20 apart on y-axis
            //fuxk x axis
            cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            cGame.spriteBatch.DrawString(Arial, player1Score, new Vector2(5.0f, 5.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B));
            cGame.spriteBatch.DrawString(Arial, player2Score, new Vector2(600.0f, 5.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B));
            cGame.spriteBatch.DrawString(Arial, gameTimer, new Vector2(300.0f, 5.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B));

            cGame.spriteBatch.Draw(CircleBar, new Rectangle(0, 550, 800 * CircleCount / maxEnemyNumber, 50), Color.White);
            cGame.spriteBatch.Draw(NeutralBar, new Rectangle(800 * CircleCount / maxEnemyNumber, 550, 800 * NeutralCount / maxEnemyNumber, 50), Color.White);
            cGame.spriteBatch.Draw(SquareBar, new Rectangle(800 * (CircleCount + NeutralCount) / maxEnemyNumber, 550, 800 * SquareCount / maxEnemyNumber, 50), Color.White);
            cGame.spriteBatch.End();
        }
Ejemplo n.º 5
0
        public void update(GameTime gametime, Master master)
        {
            //calculate the transform matrix
            transform = Matrix.Identity *
                //translate by negative position
                Matrix.CreateTranslation(-position.X, -position.Y, 0) *
                Matrix.CreateScale(scale) *
                //rotate about z axis
                //math.createrotationz(1.75f) *
                //translate by the origin amount
                Matrix.CreateTranslation(viewportwidth / 2, viewportheight / 2, 0);
            translate = Matrix.Identity *
                //translate by negative position
                Matrix.CreateTranslation(-position.X, -position.Y, 0) *
                //rotate about z axis
                //math.createrotationz(1.75f) *
                //translate by the origin amount
                Matrix.CreateTranslation(viewportwidth / 2, viewportheight / 2, 0);
            //delta so the movement seems smoooth
            float delta = (float)gametime.ElapsedGameTime.TotalSeconds;
            //get a rectangle which contains all the players
            Rectangle players = master.playerspace();
            //pad the rectangle
            players.X -= 200;
            players.Y -= 200;
            players.Width += 400;
            players.Height += 400;
            position = smoothstep(position, new Vector2(players.Center.X, players.Center.Y), movespeed);

            //create a scale based on the the size of the player rectangle in respect to the original viewport size
            float xscale = viewportwidth / players.Width;
            float yscale = viewportheight/ players.Height;
            //use the largest scaling value, the smaller value scale will still include all the picture from the larger scale
            float newscale = (xscale < yscale) ? xscale : yscale;
            //clamp the scale to the min or max
            newscale = clamp(newscale, minscale, maxscale);
            //smooth the scaling
            scale = smoothstep(scale, newscale, scalespeed);
            //currently not using the rotation, but it is in there for future reference
        }
Ejemplo n.º 6
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     master = new Master(this);
     Content.RootDirectory = "Content";
 }