コード例 #1
0
        public FourPlayerState(ContentManager Content)
        {
            player1 = new Paddle(Content.Load<Texture2D>("rodeSpeler"), Content.Load<Texture2D>("balRood"), new Vector2(0, 400), 350, Keys.W, Keys.S, true, "Player 1");
            player2 = new Paddle(Content.Load<Texture2D>("blauweSpeler"), Content.Load<Texture2D>("balBlauw"), new Vector2(Practicum1.Screen.X - 16, 400), 350, Keys.Up, Keys.Down, true, "Player 2");
            player3 = new Paddle(Content.Load<Texture2D>("geleSpeler"), Content.Load<Texture2D>("balGeel"), new Vector2(400, 0), 350, Keys.U, Keys.I, false, "Player 3");
            player4 = new Paddle(Content.Load<Texture2D>("groeneSpeler"), Content.Load<Texture2D>("balGroen"), new Vector2(400, Practicum1.Screen.Y - 16), 350, Keys.V, Keys.B, false, "Player 4");
            
            paddleList.Add(player1);
            paddleList.Add(player2);
            paddleList.Add(player3);
            paddleList.Add(player4);

            ball = new Ball(Content.Load<Texture2D>("bal"), new Vector2(Practicum1.Screen.X / 2, Practicum1.Screen.Y / 2), 275, paddleList, "Ball");
            
            powerUp1 = new PowerUp(null, new Vector2(0, 0), Content, "Powerup 1");
            powerUp2 = new PowerUp(null, new Vector2(0, 0), Content, "Powerup 2");
            
            powerUpList.Add(powerUp1);
            powerUpList.Add(powerUp2);

            pausedText = new TextObject("Game paused.", new Vector2(Practicum1.Screen.X / 2 - 80, Practicum1.Screen.Y / 2), Color.Black, null, "Pause Text");
            pausedText.Visible = false;

            
            this.Add(player1);
            this.Add(player2);
            this.Add(player3);
            this.Add(player4);
            this.Add(ball);
            this.Add(powerUp1);
            this.Add(powerUp2);
            this.Add(pausedText);
        }
コード例 #2
0
        public MainMenuState()
        {
            pressPText = new TextObject("Press <P> to\ntoggle powerups", new Vector2(Practicum1.Screen.X - 250, 25), Color.Black, null, "Press P Text");
            powerUpsToggleText = new TextObject("Powerups: ", new Vector2(Practicum1.Screen.X - 250, 90), Color.Black, null, "PowerUps Toggle Text");
            powerUpsToggleText2 = new TextObject("On", new Vector2(Practicum1.Screen.X - 100, 90), Color.Green, null, "PowerUps Toggle Text 2");
            pressStartText = new TextObject("Press to play:\n    <1> One player vs AI\n    <2> Two players\n    <3> Four players\n    <4> Trololol?\n\nPress F1 for controls", new Vector2(Practicum1.Screen.X/2-180, Practicum1.Screen.Y/2-50), Color.Black, null, "Main Menu Text");

            this.Add(pressPText);
            this.Add(powerUpsToggleText);
            this.Add(powerUpsToggleText2);
            this.Add(pressStartText);
        }
コード例 #3
0
 public override void Update(GameTime gameTime)
 {
     winPaddle = Practicum1.WinPaddle;
     if(winText == null)
     {
         winText = new TextObject(winPaddle.Name + " has won! Press space to return to main menu", new Vector2(Practicum1.Screen.X / 2 - 200, Practicum1.Screen.Y - 150), Color.Black, null, "winText");
         this.Add(winText);
     }
     else
     {
         winText.Text = winPaddle.Name + " has won!\nPress space to return to main menu";
     }
 }
コード例 #4
0
 public HelpState()
 {
     string text = "Controls\n\n    Player 1 (left): W and S\n    Player 2 (right): Up and Down arrow keys\n    Player 3 (top): O and P\n    Player 4 (bottom): V and B";
     helpText = new TextObject(text, new Vector2(100, 100), Color.Black, null, "helpText");
     this.Add(helpText);
 }