Beispiel #1
0
        static TiledPolygonObject ParsePolygonObject(XmlNode node, TiledObject baseObj)
        {
            var     obj = new TiledPolygonObject(baseObj);
            XmlNode polyXml;

            if (node["polygon"] != null)
            {
                polyXml    = node["polygon"];
                obj.Closed = true;
            }
            else
            {
                polyXml    = node["polyline"];
                obj.Closed = false;
            }

            var pointStrings = polyXml.Attributes["points"].Value.Split(' ');

            var points = new Vector2[pointStrings.Length];

            for (var i = 0; i < points.Length; i += 1)
            {
                var vecStr = pointStrings[i].Split(',');
                points[i] = new Vector2(
                    float.Parse(vecStr[0], CultureInfo.InvariantCulture),
                    float.Parse(vecStr[1], CultureInfo.InvariantCulture)
                    );
            }
            obj.Points = points;

            return(obj);
        }
Beispiel #2
0
 public MapObject(TiledObject obj, Scene scene)
 {
     this.obj   = obj;
     this.scene = scene;
     this.transform.setPosition(new Vector2(obj.x, obj.y));
     initialize();
 }
Beispiel #3
0
 //----------------------------------------------------------------------------------------
 //                                        Constructor
 //----------------------------------------------------------------------------------------
 /// <summary>
 /// Constructor of the player
 /// </summary>
 #region Constructor
 public Player(string filename, int cols, int rows, TiledObject obj) : base(filename, cols, rows)
 {
     imscared.x         -= 50;
     imscared.y         -= 100;
     pressWASD.x        -= 50;
     pressWASD.y        -= 100;
     eek.x              -= 50;
     eek.y              -= 100;
     hideOrRun.x        -= 50;
     hideOrRun.y        -= 100;
     pressQ.x           -= 50;
     pressQ.y           -= 100;
     or.x               -= 50;
     or.y               -= 100;
     pressShift.x       -= 50;
     pressShift.y       -= 100;
     meat.x             -= 50;
     meat.y             -= 100;
     lure.x             -= 50;
     lure.y             -= 100;
     pressE.x           -= 50;
     pressE.y           -= 100;
     canhelpmeout.x     -= 50;
     canhelpmeout.y     -= 100;
     throwStone.x       -= 50;
     throwStone.y       -= 100;
     dontletmethrough.x -= 50;
     dontletmethrough.y -= 100;
     defeat5.x          -= 50;
     defeat5.y          -= 100;
     SetOrigin(width / 2, height / 2);
     AddChild(healthbar);
     AddChild(hudsmallmeat);
 }
Beispiel #4
0
        void ReadObjectLayers(ContentReader input, TiledMap map)
        {
            var layersCount = input.ReadInt32();
            var layers      = new TiledMapObjectLayer[layersCount];

            for (var i = 0; i < layersCount; i += 1)
            {
                var layer = new TiledMapObjectLayer();
                ReadLayer(input, layer);

                layer.DrawingOrder = (TiledMapObjectDrawingOrder)input.ReadByte();
                layer.Color        = input.ReadColor();

                var objectsCount = input.ReadInt32();
                var objects      = new TiledObject[objectsCount];

                for (var k = 0; k < objectsCount; k += 1)
                {
                    objects[k] = ReadObject(input, map);
                }

                layer.Objects = objects;

                layers[i] = layer;
            }

            map.ObjectLayers = layers;
        }
Beispiel #5
0
        public Entity Make(TiledObject obj, Layer layer, MapBuilder map)
        {
            var tile = (TiledTileObject)obj;

            // Origin point for tile object is in the bottom left corner,
            // but rotation point is in the center.
            var matrix = Matrix.CreateTranslation(new Vector3(Spikes.Size, -Spikes.Size, 0) / 2) *
                         Matrix.CreateRotationZ(MathHelper.ToRadians(tile.Rotation));

            var position = new Vector2(matrix.Translation.X, matrix.Translation.Y) + tile.Position;

            var cannon = new Cannon(
                position,
                (Cannon.ShootingMode)Enum.Parse(typeof(Cannon.ShootingMode), tile.Properties["shootingMode"]),
                tile.Rotation,
                float.Parse(tile.Properties["baseRotation"], CultureInfo.InvariantCulture),
                float.Parse(tile.Properties["firePeriod"], CultureInfo.InvariantCulture),
                float.Parse(tile.Properties["initialDelay"], CultureInfo.InvariantCulture),
                layer
                );


            if (tile.Properties["link_trigger"] != "none")
            {
                cannon.AddComponent(new LinkComponent(tile.Properties["link_trigger"]));
            }

            return(cannon);
        }
Beispiel #6
0
        /// <summary>
        /// Will randomly add enemies
        /// </summary>
        public override void update()
        {
            base.update();
            if (this.scene != null)
            {
                //if chance is true, then start process of creating an enemy
                if (Nez.Random.chance(.05f))
                {
                    Enemy enemy = new Enemy(map, numCollisionLayers, numObjLayers, graphics);

                    TiledObject spawnObj = null;

                    for (int i = 0; i < numCollisionLayers; i++)
                    {
                        int              num       = i + 1;
                        string           layerName = "ObjLayer" + num.ToString();
                        TiledObjectGroup group     = map.getObjectGroup(layerName);
                        //Gets the Obj to spawn at (Not correct right now because it will just end up grabbing a random SpawnGround obj from the LAST obj layer, when it should be a random layer)
                        spawnObj = group.getObjectsOfType("SpawnGround")[Nez.Random.range(0, group.getObjectsOfType("SpawnGround").Count)];
                    }

                    int xSpawn = Nez.Random.range(spawnObj.x, spawnObj.x + spawnObj.width);
                    int ySpawn = (int)(spawnObj.y) - 1;

                    //Finally move the enemy to its psuedo spawn position (entity has to move itself to the correct spawn based off its collider)
                    enemy.transform.setPosition(new Vector2(xSpawn, ySpawn));

                    this.scene.addEntity(enemy);
                }
            }
        }
Beispiel #7
0
        static TiledTextObject ParseTextObject(XmlNode node, TiledObject baseObj)
        {
            var textXml = node["text"];
            var obj     = new TiledTextObject(baseObj);

            obj.Text = textXml.InnerText;
            if (textXml.Attributes["color"] != null)
            {
                obj.Color = XmlHelper.StringToColor(textXml.Attributes["color"].Value);
            }
            obj.WordWrap = XmlHelper.GetXmlBoolSafe(textXml, "color", false);

            obj.HorAlign = (TiledTextAlign)XmlHelper.GetXmlEnumSafe(
                textXml,
                "halign",
                TiledTextAlign.Left
                );
            obj.VerAlign = (TiledTextAlign)XmlHelper.GetXmlEnumSafe(
                textXml,
                "valign",
                TiledTextAlign.Left
                );

            obj.Font       = XmlHelper.GetXmlStringSafe(textXml, "fontfamily");
            obj.FontSize   = XmlHelper.GetXmlIntSafe(textXml, "pixelsize");
            obj.Underlined = XmlHelper.GetXmlBoolSafe(textXml, "underline");
            obj.StrikedOut = XmlHelper.GetXmlBoolSafe(textXml, "strikeout");

            return(obj);
        }
Beispiel #8
0
 public static RectangleF GetRectangleF(this TiledObject tiledObject)
 => new RectangleF(
     x: tiledObject.X,
     y: tiledObject.Y,
     width: tiledObject.Width,
     height: tiledObject.Height
     );
Beispiel #9
0
        static Dictionary <string, TiledObject[]> LoadTiledObjects(TmxMap map)
        {
            Dictionary <string, TiledObject[]> ret = new();

            foreach (var layer in map.ObjectGroups)
            {
                List <TiledObject> objs = new ();

                foreach (var item in layer.Objects)
                {
                    var moveAmount = 0f;
                    if (item.Properties.ContainsKey("MoveAmount"))
                    {
                        moveAmount = float.Parse(item.Properties["MoveAmount"], NumberStyles.Float, CultureInfo.InvariantCulture);
                    }

                    var obj = new TiledObject(
                        new Vector2((float)item.X, (float)item.Y),
                        (int)item.Width,
                        (int)item.Height,
                        moveAmount
                        );

                    objs.Add(obj);
                }

                ret.Add(layer.Name, objs.ToArray());
            }
            return(ret);
        }
Beispiel #10
0
        private void CreateShop(TiledObject shopObj, int x, int y)
        {
            var shopType = shopObj.Properties["Type"];

            if (shopType == null)
            {
                return;
            }
            var shopTexture = ImageManager.loadMisc("Panel" + shopType);
            var type        = GameShopType.None;

            switch (shopType)
            {
            case "Ammo":
                type = GameShopType.Ammo;
                break;

            case "Hearts":
                type = GameShopType.Hearts;
                break;

            case "Lives":
                type = GameShopType.Lives;
                break;
            }
            var arrowsTexture = ImageManager.loadSystem("ShopUpButton");
            var shop          = new GameShop(type, shopTexture, arrowsTexture, new Vector2(x, y));

            _shops.Add(shop);
        }
Beispiel #11
0
        /// <summary>
        /// Gets the physics mode of the object, or returns the default.
        /// </summary>
        /// <param name="obj">The invoking TiledObject.</param>
        /// <returns>The BodyType of the object.</returns>
        public static BodyType GetBodyType(this TiledObject obj)
        {
            string physics = string.Empty;

            obj.Properties.TryGetValue("physics", out physics);

            BodyType result = BodyType.Static;

            if ("dynamic".Equals(physics, StringComparison.OrdinalIgnoreCase))
            {
                result = BodyType.Dynamic;
            }
            else if ("kinematic".Equals(physics, StringComparison.OrdinalIgnoreCase))
            {
                result = BodyType.Kinematic;
            }
            else if ("static".Equals(physics, StringComparison.OrdinalIgnoreCase))
            {
                result = BodyType.Static;
            }
            else if (!string.IsNullOrWhiteSpace(physics))
            {
                Console.Write("[{0}] ", nameof(EntityFactory));
                Console.WriteLine("Unrecognized physics value '{0}' for object '{2}'.",
                                  physics, obj.Name);
            }

            return(result);
        }
Beispiel #12
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
            player.Load(Content);
            enemy.Load(Content);

            var ViewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, ScreenWidth, ScreenHeight);

            Camera          = new Camera2D(ViewportAdapter);
            Camera.Position = new Vector2(0, ScreenHeight);

            Map = Content.Load <TiledMap>("Level1");
            foreach (TiledTileLayer Layer in Map.TileLayers)
            {
                if (Layer.Name == "Collisions")
                {
                    CollisionLayer = Layer;
                }
            }
            Arialfont = Content.Load <SpriteFont>("Arial");
            Heart     = Content.Load <Texture2D>("Heart");

            AIE.StateManager.CreateState("Splash", new SplashState());
            AIE.StateManager.CreateState("Game", new GameState());
            AIE.StateManager.CreateState("GamerOver", new GameOverState());

            AIE.StateManager.PushState("Splash");

            foreach (TiledObjectGroup Group in Map.ObjectGroups)
            {
                if (Group.Name == "Enemies")
                {
                    foreach (TiledObject Obj in Group.Objects)
                    {
                        Enemy enemy = new Enemy(this);
                        enemy.Load(Content);
                        enemy.Position = new Vector2(Obj.X, Obj.Y);
                        Enemies.Add(enemy);
                    }
                }
                if (Group.Name == "Goal")
                {
                    TiledObject Obj = Group.Objects[0];
                    if (Obj != null)
                    {
                        AnimatedTexture Anim = new AnimatedTexture(Vector2.Zero, 0, 1, 1);

                        Anim.Load(Content, "Goal", 1, 1);
                        Goal = new Sprite();
                        Goal.Add(Anim, 0, 5);
                        Goal.position = new Vector2(Obj.X, Obj.Y);
                    }
                }
            }
            GameMusic = Content.Load <Song>("SuperHero_original_no_Intro");
            MediaPlayer.Play(GameMusic);
        }
Beispiel #13
0
 /// <summary>
 /// Makes entity from Tiled temmplate using factory pool.
 /// </summary>
 public static Entity MakeEntity(TiledObject obj, Layer layer, MapBuilder map)
 {
     if (_factoryPool.TryGetValue(obj.Type, out ITiledEntityFactory factory))
     {
         return(factory.Make(obj, layer, map));
     }
     return(null);
 }
Beispiel #14
0
        public static Entity CreatePlayer(Scene scene, int playerId, TiledObject spawnObj, TiledTileLayer collisionLayer)
        {
            var player = scene.addEntity(new Entity($"player{spawnObj.name}")).setPosition(spawnObj.position);
            var origin = new Vector2(8, 8);


            var texture     = scene.content.Load <Texture2D>("samurai");
            var subtextures = Subtexture.subtexturesFromAtlas(texture, 32, 16, 0, 4);

            subtextures[0].origin = new Vector2(8, 8);
            subtextures[1].origin = new Vector2(8, 8);
            subtextures[2].origin = new Vector2(8, 8);
            subtextures[3].origin = new Vector2(8, 8);
            var sprite = player.addComponent(new Sprite <PlayerAnims>(subtextures[2]));

            sprite.addAnimation(PlayerAnims.Normal, new SpriteAnimation(subtextures[0]));
            var attackAnim = new SpriteAnimation(subtextures.GetRange(0, 4));

            attackAnim.setLoop(false);
            sprite.addAnimation(PlayerAnims.Attack, attackAnim);
            sprite.play(PlayerAnims.Normal);
            player.addComponent(new Input(playerId));
            var box = player.addComponent(new BoxColliderFlip(-3, -6, 10, 14));

            box.name               = "movebox";
            box.physicsLayer       = 1 << 2;
            box.collidesWithLayers = 1 << 0;
            player.addComponent(new TiledMapMover(collisionLayer));
            var controller = player.addComponent <PlayerController>();

            player.addComponent(new ScreenWrapComponent(new Vector2(256, 144), new Vector2(16, 16), sprite));
            var hitbox = player.addComponent(new BoxColliderFlip(8, -8, 16, 16));

            hitbox.name               = "hitbox";
            hitbox.physicsLayer       = 1 << 3;
            hitbox.collidesWithLayers = 1 << 4;
            hitbox.active             = false;
            hitbox.isTrigger          = true;

            var hurtBox = player.addComponent(new BoxColliderFlip(-3, -6, 10, 14));

            hurtBox.name               = "hurtbox";
            hurtBox.physicsLayer       = 1 << 4;
            hurtBox.collidesWithLayers = 1 << 3;
            player.addComponent(new AttackController());
            player.addComponent <EnemyHit>();


            sprite.onAnimationCompletedEvent += (anim) =>
            {
                if (anim == PlayerAnims.Attack)
                {
                    hitbox.active = false;
                    sprite.play(PlayerAnims.Normal);
                }
            };
            return(player);
        }
Beispiel #15
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
            player.Load(Content);

            arialFont = Content.Load <SpriteFont>("Arial");
            heart     = Content.Load <Texture2D>("heart");


            var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice,
                                                            (int)(graphics.GraphicsDevice.Viewport.Width), (int)(graphics.GraphicsDevice.Viewport.Height));

            camera          = new Camera2D(viewportAdapter);
            camera.Position = player.Position - new Vector2(ScreenWidth, ScreenHeight);

            map = Content.Load <TiledMap>("Level1");
            foreach (TiledTileLayer layer in map.TileLayers)
            {
                if (layer.Name == "Collisions")
                {
                    collisionLayer = layer;
                }
            }

            foreach (TiledObjectGroup group in map.ObjectGroups)
            {
                if (group.Name == "enemies")
                {
                    foreach (TiledObject obj in group.Objects)
                    {
                        Enemy enemy = new Enemy(this);
                        enemy.Load(Content);
                        enemy.Position = new Vector2(obj.X, obj.Y);
                        enemies.Add(enemy);
                    }
                }
                if (group.Name == "goal")
                {
                    TiledObject obj = group.Objects[0];
                    if (obj != null)
                    {
                        AnimatedTexture anim = new AnimatedTexture(
                            Vector2.Zero, 0, 1, 1);
                        anim.Load(Content, "chest", 1, 1);
                        goal = new Sprite();
                        goal.Add(anim, 0, 5);
                        goal.position = new Vector2(obj.X, obj.Y);
                    }
                }
            }

            gameMusic = Content.Load <Song>("Superhero_Violin");
            MediaPlayer.Play(gameMusic);
        }
Beispiel #16
0
 private void PathfindingSetup()
 {
     SpawnLocation      = transform.position;
     PlayerSpawn        = TileMap.getObjectGroup("objects").objectWithName("spawn");
     Start              = new Point((int)SpawnLocation.X, (int)SpawnLocation.Y);
     End                = new Point(PlayerSpawn.x, PlayerSpawn.y);
     WeightedSearchPath = WeightedGraph.search(Start, End);
     SetState(EnemyState.Following);
 }
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        public override void initialize()
        {
            clearColor = Color.LightSkyBlue;
            addRenderer(new DefaultRenderer());

            #region setup everything for Tiled Map
            tileMap = content.Load <TiledMap>(this.mapName);
            var tileEntity = createEntity("Tiled-Entity");
            //Add the collidable layers to the tile entity
            //Have to do this for all collision layers for physics to properly work
            for (int i = 0; i <= numOfCollisionLayers; i++)
            {
                int    num       = i + 1;
                string layerName = "CollidableLayer" + num.ToString();              //All layers that contain tiles that have collision must be named "CollidableLayer" followed by a number
                tileEntity.addComponent(new TiledMapComponent(tileMap, layerName)); //                                               the numbers must be increasing sequentially
            }
            //Fill the object layers list
            for (int i = 0; i < numOfObjLayers; i++)
            {
                int    num       = i + 1;
                string layerName = "ObjLayer" + num.ToString(); //All object layers must be named "ObjLayer" followed by a number. The numbers must be increasing sequentially
                objectLayers.Add(tileMap.getObjectGroup(layerName));
            }
            #endregion

            #region setup player and add to scene
            //Find the spawn point in the object layers list then set the players position to it
            TiledObject spawn = null;
            foreach (TiledObjectGroup objectLayer in objectLayers)
            {
                if (objectLayer.objectWithName("SpawnPoint") != null)
                {
                    spawn = objectLayer.objectWithName("SpawnPoint");
                }
            }
            //var player = createEntity("Player");
            Player player = new Player(tileMap, numOfCollisionLayers, numOfObjLayers, graphicsDevice);
            player.name = "Player"; //Set the name of the player so it can be easily found later
            addEntity(player);
            player.transform.setPosition(new Vector2(spawn.x, spawn.y));
            #endregion

            #region Add and setup a camera to follow the player
            //Add and setup camera
            var playerCamera = new FollowCamera(player, player.scene.camera);
            playerCamera.Y_offset = 0;
            player.addComponent(playerCamera);
            //Try to set deadzone of playerCamera
            Core.schedule(0.03f, t => playerCamera.setCenteredDeadzone(50, 50));
            #endregion

            #region Start the enemy spawner
            //Start spawning enemies with the enemy spawner
            EnemySpawner spawner = new EnemySpawner(tileMap, numOfCollisionLayers, numOfObjLayers, graphicsDevice);
            addEntity(spawner);
            #endregion
        }
Beispiel #18
0
        public Entity Make(TiledObject obj, Layer layer, MapBuilder map)
        {
            var tile = (TiledTileObject)obj;

            var position = tile.Position
                           + Vector2.UnitX * Resources.Sprites.Default.CheckpointPedestal.Width / 2;

            return(new Checkpoint(position, layer));
        }
Beispiel #19
0
 public static Rectangle ToRectangle(this TiledObject obj)
 {
     return(new Rectangle(
                (int)obj.X,
                (int)obj.Y,
                (int)obj.Width,
                (int)obj.Height
                ));
 }
Beispiel #20
0
        TiledObject ReadPolygonObject(ContentReader input, TiledObject baseObj)
        {
            var obj = new TiledPolygonObject(baseObj);

            obj.Closed = input.ReadBoolean();
            obj.Points = input.ReadObject <Vector2[]>();

            return(obj);
        }
Beispiel #21
0
 public Node(TiledObject tile)
 {
     Id             = tile.id;
     Position       = tile.position;
     Name           = tile.name;
     ConnectedNodes = tile.properties["ConnectedNodes"]
                      .Split(',')
                      .Select(int.Parse)
                      .ToList();
 }
Beispiel #22
0
        private void AddPlayerEntity(TiledObject spawn, string entityName)
        {
            var player = createEntity(entityName);

            player.transform.setPosition(spawn.x, spawn.y);
            player.addComponent(new PrototypeSprite(32, 32)).setColor(Color.Red);
            player.addComponent <PlayerController>();
            player.addComponent(new TiledMapMover(Map.getLayer <TiledTileLayer>("main")));
            player.addComponent(new BoxCollider(-16, -16, 32, 32));
        }
Beispiel #23
0
        public Entity Make(TiledObject obj, Layer layer, MapBuilder map)
        {
            var poly = (TiledPolygonObject)obj;

            var width = float.Parse(poly.Properties["width"], CultureInfo.InvariantCulture);
            var speed = float.Parse(poly.Properties["speed"], CultureInfo.InvariantCulture);

            var entity = new MovingPlatofrm(layer, poly.Position, width, poly.Closed, speed, new List <Vector2>(poly.Points));

            return(entity);
        }
 private bool CheckForPlayerPosition(TiledObject position)
 {
     if (Player.PlayerRef.transform.position.X == position.x)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #25
0
 void WriteBaseObject(ContentWriter output, TiledObject obj)
 {
     output.Write(obj.Name);
     output.Write(obj.Type);
     output.Write(obj.ID);
     output.Write(obj.Position);
     output.Write(obj.Size);
     output.Write(obj.Rotation);
     output.Write(obj.Visible);
     output.WriteObject(obj.Properties);
 }
 public void SpawnEnemy(TiledObject enemy)
 {
     switch (enemy.objectType)
     {
     case "Enemy1":
         EnemyEntity e = new EnemyEntity(_enemyTextures[0], _bulletTextures[0]);
         e.transform.position = enemy.position;
         addEntity(e);
         break;
     }
 }
Beispiel #27
0
            internal static TiledObjectGroup Parse(XmlElement objGrpElt, int tileWidth, int tileHeight)
            {
                string name           = GetStrAttribute(objGrpElt, "name");
                var    objectElements = objGrpElt.SelectNodes("object");
                var    objects        = MapElements(objectElements, e => TiledObject.Parse(e, tileWidth, tileHeight));

                return(new TiledObjectGroup()
                {
                    Name = name, Objects = objects.ToList(),
                });
            }
Beispiel #28
0
        private void CreateRectangle(TiledObject obj)
        {
            float rectWidth  = ConvertUnits.ToSimUnits(obj.Width);
            float rectHeight = ConvertUnits.ToSimUnits(obj.Height);

            var body = BodyFactory.CreateRectangle(
                physicsWorld, rectWidth, rectHeight, obj.GetDensity());

            body.Position      = obj.GetObjectCenter();
            body.FixedRotation = true;
            body.BodyType      = BodyType.Static;
        }
Beispiel #29
0
        TiledObject ReadTileObject(ContentReader input, TiledObject baseObj, TiledMap map)
        {
            var obj = new TiledTileObject(baseObj);

            obj.GID     = input.ReadInt32();
            obj.FlipHor = input.ReadBoolean();
            obj.FlipVer = input.ReadBoolean();

            obj.Tileset = map.GetTileset(obj.GID);

            return(obj);
        }
Beispiel #30
0
        private static void ReadGenericObjectInformation(TiledObject obj, XElement root)
        {
            obj.Name = root.ReadAttribute("name", string.Empty);
            obj.Type = root.ReadAttribute("type", string.Empty);
            obj.X = root.ReadAttribute("x", 0.0m);
            obj.Y = root.ReadAttribute("y", 0.0m);
            obj.Width = root.ReadAttribute("width", 0.0m);
            obj.Height = root.ReadAttribute("height", 0.0m);

            // Read object properties.
            PropertyParser.ReadProperties(obj, root);
        }
Beispiel #31
0
    public Block(ArkanoidLevelScreen _levelInst, TiledObject _obj) : base("ArkanoidSprites/Breakout-006-A.png", 5, 5)
    {
        SetXY(_obj.X, _obj.Y);
        _blockHealth = _obj.GetIntProperty("health");

        _level = _levelInst;

        _canBlockBeDestroyed = _obj.GetBoolProperty("canBeDestroyed");
        SetFrame(_obj.GetIntProperty("type"));

        _destroyableBlockSound = new Sound("ArkanoidSounds/BallHitBox.mp3");
    }
 public TiledObjectGroup(string name, TiledObject[] objects)
 {
     Name = name;
     Objects = objects;
     Properties = new TiledProperties();
 }