public ObjectSpawnController(EventHandler eventHandler, List<GameObject> gameObjects, GraphicsHandler2D graphicsHandler, Map_2DTile map)
 {
     this.eventHandler = eventHandler;
     this.gameObjects = gameObjects;
     this.graphicsHandler = graphicsHandler;
     this.map = map;
 }
 public SnapToTileMovementComponent(EventHandler eventHandler, Map_2DTile m, List<GameObject> gameObjects, int StartingPosX, int StartingPosY)
     : base(eventHandler)
 {
     this.m = m;
     this.gameObjects = gameObjects;
     targetPosX = StartingPosX;
     targetPosY = StartingPosY;
 }
 public Map_2DPlattformerTileCollisionComponent(EventHandler eventHandler, Map_2DTile m)
     : base(eventHandler)
 {
     this.m = m;
 }
Пример #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // TODO: use this.Content to load your game content here

            // Map
            map = new Map_2DTile();
            map.Load(Content, "./Content/Map1.txt");

            graphicsHandler.AddImage("player", Content.Load<Texture2D>("slime_medium"));
            graphicsHandler.AddImage("bomb", Content.Load<Texture2D>("bomb"));
            graphicsHandler.AddImage("explosion", Content.Load<Texture2D>("explosion"));

            objectSpawnController = new ObjectSpawnController(eventHandler, gameObjects, graphicsHandler, map);
            collisionHandler = new CollisionHandler(eventHandler, gameObjects);
            // How a spawn player event would be added, with the spawn code genereated inside ObjectSpawnController.
            eventHandler.QueueEvent(new SpawnEvent("player"));

            eventHandler.QueueEvent(new SpawnEvent("player2"));

            font = Content.Load<SpriteFont>("font");
        }
 public ExpandComponent(EventHandler eventHandler, Map_2DTile map, int expandLimit)
     : base(eventHandler)
 {
     this.map = map;
     this.expandLimit = expandLimit;
 }