Exemple #1
0
 public Wall(ContentManager rootContent, SpriteBatch rootSpriteBatch, AABBPhysicsHandler physicsHandler, float X, float Y, float Width, float Height)
 {
     content             = rootContent;
     spriteBatch         = rootSpriteBatch;
     this.physicsHandler = physicsHandler;
     this.X        = X;
     this.Y        = Y;
     this.Height   = Height;
     this.Width    = Width;
     collisionType = CollisionType.wall;
 }
Exemple #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            spriteBatch           = new SpriteBatch(GraphicsDevice);
            Content.RootDirectory = "Content";
            physicsHandler        = new AABBPhysicsHandler();

            player      = new Player(Content, spriteBatch, physicsHandler);
            gameObjects = new List <GameObject>()
            {
                player
            };
            walls = new List <Wall>();
            player.SetWalls(walls);

            Wall wall1 = new Wall(Content, spriteBatch, physicsHandler, 40, 300, 700, 50);
            Wall wall2 = new Wall(Content, spriteBatch, physicsHandler, 160, 270, 290, 30);
            Wall wall3 = new Wall(Content, spriteBatch, physicsHandler, 470, 220, 90, 10);
            Wall wall4 = new Wall(Content, spriteBatch, physicsHandler, 300, 190, 100, 30);

            walls.Add(wall1);
            walls.Add(wall2);
            walls.Add(wall3);
            walls.Add(wall4);

            gameObjects.Add(wall1);
            gameObjects.Add(wall2);
            gameObjects.Add(wall3);
            gameObjects.Add(wall4);

            foreach (GameObject gameObject in gameObjects)
            {
                gameObject.Initialize();
            }

            base.Initialize();
        }
Exemple #3
0
 public Player(ContentManager rootContent, SpriteBatch rootSpriteBatch, AABBPhysicsHandler physicsHandler)
 {
     content             = rootContent;
     spriteBatch         = rootSpriteBatch;
     this.physicsHandler = physicsHandler;
 }