예제 #1
0
        internal Player0(string name)
        {
            Name = name;

            var sprite = SpriteCache.LoadSprite(Program.ContentDirectory + $"Player\\player.png");

            DefaultSpriteId = sprite?.Id;

            var dataSprite = SpriteCache.LoadSprite(Program.ContentDirectory + $"Player\\player-data.png");

            if (dataSprite != null)
            {
                BoundingBox = AABB.Merge(AABB.FromMap(dataSprite, Level.ObstacleMask));
            }

            else if (sprite != null)
            {
                BoundingBox = new AABB(Vector2f.Zero, sprite.Size);
            }

            ChangeMovement(new Idle());
        }
예제 #2
0
        public Platform(string name, IEnumerable <Vector2f> path = null) : base(default)
        {
            var sprite = SpriteCache.LoadSprite(Program.ContentDirectory + $"World\\{ name }.png");

            SpriteId = sprite?.Id;

            var dataSprite = SpriteCache.LoadSprite(Program.ContentDirectory + $"World\\{ name }-data.png");

            if (dataSprite != null)
            {
                BoundingBox = AABB.Merge(AABB.FromMap(dataSprite, Level.ObstacleMask));
            }

            else if (sprite != null)
            {
                BoundingBox = new AABB(Vector2f.Zero, sprite.Size);
            }

            if (path != null)
            {
                Path.AddRange(path);
                Position = Path.First();
            }
        }