Beispiel #1
0
 public TextEntity(World world, Vector2 location, string text, SpriteFont font, Color color)
     : base(world, location)
 {
     Text = text;
     Font = font;
     Color = color;
 }
Beispiel #2
0
 public PaddleEntity(World world, Vector2 location, Texture2D sprite, Keys upKey, Keys downKey, Keys leftKey, Keys rightKey)
     : base(world, location, sprite)
 {
     UpKey = upKey;
     DownKey = downKey;
     LeftKey = leftKey;
     RightKey = rightKey;
 }
Beispiel #3
0
        public LineEntity(World world, Vector2 location, Vector2 location2, Color color, float thickness)
            : base(world, location)
        {
            Location2 = location2;
            Color = color;
            Thickness = thickness;

            Angle = (float)Math.Atan2(Location2.Y - Location.Y, Location2.X - Location.X);
        }
Beispiel #4
0
        public MenuWorld(Game game, World world, Rectangle size, ContentManager contentManager)
            : base(game, world, size)
        {
            BackgroundColor = Color.Transparent;

            Texture2D buttonAI = contentManager.Load<Texture2D>("buttonAI");
            Texture2D buttonHuman = contentManager.Load<Texture2D>("buttonHuman");
            Texture2D buttonEasy = contentManager.Load<Texture2D>("buttonEasy");
            Texture2D buttonNormal = contentManager.Load<Texture2D>("buttonNormal");
            Texture2D buttonHard = contentManager.Load<Texture2D>("buttonHard");

            PaddleEntity player1 = ((PongWorld)ParentWorld).Players[0];
            PaddleEntity player2 = ((PongWorld)ParentWorld).Players[1];
            PaddleEntity player3 = ((PongWorld)ParentWorld).Players[2];
            PaddleEntity player4 = ((PongWorld)ParentWorld).Players[3];

            // Buttons
            // Resume
            ResumeButtonEntity Resume = new ResumeButtonEntity(this, new Vector2(Size.Width / 2, Size.Height / 7), contentManager.Load<Texture2D>("buttonResume"));
            Resume.Origin = new Vector2(Resume.Sprite.Width / 2, Resume.Sprite.Height / 2);
            Entities.Add(Resume);

            // Player1
            PlayerEnabledButtonEntity Player1 = new PlayerEnabledButtonEntity(this, new Vector2(Size.Width / 3, Size.Height / 7 * 2), player1, contentManager.Load<Texture2D>("buttonPlayer1"), contentManager.Load<Texture2D>("buttonPlayer1Off"));
            Player1.Origin = new Vector2(Player1.Sprite.Width / 2, Player1.Sprite.Height / 2);
            Entities.Add(Player1);

            PlayerAIButtonEntity Player1AI = new PlayerAIButtonEntity(this, new Vector2(Size.Width / 3 - 5, Size.Height / 7 * 3), player1, buttonAI, buttonHuman);
            Player1AI.Origin = new Vector2(Player1AI.Sprite.Width, Player1AI.Sprite.Height / 2);
            Entities.Add(Player1AI);

            PlayerDifficultyButtonEntity Player1Difficulty = new PlayerDifficultyButtonEntity(this, new Vector2(Size.Width / 3 + 5, Size.Height / 7 * 3), player1, buttonEasy, buttonNormal, buttonHard);
            Player1Difficulty.Origin = new Vector2(0, Player1Difficulty.Sprite.Height / 2);
            Entities.Add(Player1Difficulty);

            // Player 2
            PlayerEnabledButtonEntity Player2 = new PlayerEnabledButtonEntity(this, new Vector2(Size.Width / 3, Size.Height / 7 * 4), player2, contentManager.Load<Texture2D>("buttonPlayer2"), contentManager.Load<Texture2D>("buttonPlayer2Off"));
            Player2.Origin = new Vector2(Player2.Sprite.Width / 2, Player2.Sprite.Height / 2);
            Entities.Add(Player2);

            PlayerAIButtonEntity Player2AI = new PlayerAIButtonEntity(this, new Vector2(Size.Width / 3 - 5, Size.Height / 7 * 5), player2, buttonAI, buttonHuman);
            Player2AI.Origin = new Vector2(Player2AI.Sprite.Width, Player2AI.Sprite.Height / 2);
            Entities.Add(Player2AI);

            PlayerDifficultyButtonEntity Player2Difficulty = new PlayerDifficultyButtonEntity(this, new Vector2(Size.Width / 3 + 5, Size.Height / 7 * 5), player2, buttonEasy, buttonNormal, buttonHard);
            Player2Difficulty.Origin = new Vector2(0, Player2Difficulty.Sprite.Height / 2);
            Entities.Add(Player2Difficulty);

            // Player 3
            PlayerEnabledButtonEntity Player3 = new PlayerEnabledButtonEntity(this, new Vector2(Size.Width / 3 * 2, Size.Height / 7 * 2), player3, contentManager.Load<Texture2D>("buttonPlayer3"), contentManager.Load<Texture2D>("buttonPlayer3Off"));
            Player3.Origin = new Vector2(Player3.Sprite.Width / 2, Player3.Sprite.Height / 2);
            Entities.Add(Player3);

            PlayerAIButtonEntity Player3AI = new PlayerAIButtonEntity(this, new Vector2(Size.Width / 3 * 2 - 5, Size.Height / 7 * 3), player3, buttonAI, buttonHuman);
            Player3AI.Origin = new Vector2(Player3AI.Sprite.Width, Player3AI.Sprite.Height / 2);
            Entities.Add(Player3AI);

            PlayerDifficultyButtonEntity Player3Difficulty = new PlayerDifficultyButtonEntity(this, new Vector2(Size.Width / 3 * 2 + 5, Size.Height / 7 * 3), player3, buttonEasy, buttonNormal, buttonHard);
            Player3Difficulty.Origin = new Vector2(0, Player3Difficulty.Sprite.Height / 2);
            Entities.Add(Player3Difficulty);

            // Player 4
            PlayerEnabledButtonEntity Player4 = new PlayerEnabledButtonEntity(this, new Vector2(Size.Width / 3 * 2, Size.Height / 7 * 4), player4, contentManager.Load<Texture2D>("buttonPlayer4"), contentManager.Load<Texture2D>("buttonPlayer4Off"));
            Player4.Origin = new Vector2(Player4.Sprite.Width / 2, Player4.Sprite.Height / 2);
            Entities.Add(Player4);

            PlayerAIButtonEntity Player4AI = new PlayerAIButtonEntity(this, new Vector2(Size.Width / 3 * 2 - 5, Size.Height / 7 * 5), player4, buttonAI, buttonHuman);
            Player4AI.Origin = new Vector2(Player4AI.Sprite.Width, Player4AI.Sprite.Height / 2);
            Entities.Add(Player4AI);

            PlayerDifficultyButtonEntity Player4Difficulty = new PlayerDifficultyButtonEntity(this, new Vector2(Size.Width / 3 * 2 + 5, Size.Height / 7 * 5), player4, buttonEasy, buttonNormal, buttonHard);
            Player4Difficulty.Origin = new Vector2(0, Player4Difficulty.Sprite.Height / 2);
            Entities.Add(Player4Difficulty);

            // Exit button
            ExitButtonEntity Exit = new ExitButtonEntity(this, new Vector2(Size.Width / 2, Size.Height / 7 * 6), contentManager.Load<Texture2D>("buttonExit"));
            Exit.Origin = new Vector2(Exit.Sprite.Width / 2, Exit.Sprite.Height / 2);
            Entities.Add(Exit);
        }
Beispiel #5
0
 public World(Game game, World world, Rectangle size)
 {
     Game = game;
     ParentWorld = world;
     Size = size;
 }
Beispiel #6
0
 public SpriteEntity(World world, Vector2 location, Texture2D sprite)
     : base(world, location)
 {
     Sprite = sprite;
 }
Beispiel #7
0
Datei: Game.cs Projekt: Qub1/Pong
        protected override void Initialize()
        {
            World = new PongWorld(this, new Rectangle(0, 0, Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight), Content);

            base.Initialize();
        }
Beispiel #8
0
 public BallEntity(World world, Vector2 location, Texture2D sprite)
     : base(world, location, sprite)
 {
 }
Beispiel #9
0
 public Entity(World world, Vector2 location)
 {
     World = world;
     Location = location;
 }