Example #1
0
        public HallsSouth(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Coliseum Halls South";
            SandbagImage = "Zones/Coliseum/Halls/south-sb";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Halls/south"));

            Doors.Add(new Door {
                Location = new Rectangle(345, 550, 50, 35), Name = "cell", Orientation = Direction.Up
            });
            Doors.Add(new Door {
                Location = new Rectangle(100, 100, 50, 35), Name = "halls-north", Orientation = Direction.Down
            });
            Doors.Add(new Door {
                Location = new Rectangle(660, 300, 35, 50), Name = "halls-east", Orientation = Direction.Left
            });

            Objects.Add(new InteractiveObject {
                Interact = SimpleDoor("coliseum/cell", "halls"), Location = new Rectangle(345, 585, 50, 25)
            });
            Objects.Add(new InteractiveObject {
                Interact = SimpleDoor("coliseum/halls-north", "halls-south"), Location = new Rectangle(100, 90, 50, 15)
            });
            Objects.Add(new InteractiveObject {
                Interact = SimpleDoor("coliseum/halls-east", "halls-south"), Location = new Rectangle(700, 300, 15, 50)
            });
        }
Example #2
0
        public static Zone Factory(Game game, Torch.Object parent, string name)
        {
            var  data = ((SRPGGame)game).ZoneData.ContainsKey(name) ? ((SRPGGame)game).ZoneData[name] : new byte[] {};
            Zone zone;

            switch (name)
            {
            case "kakariko/village":
                zone = new Zones.Kakariko.Village(game, parent, data);
                break;

            case "kakariko/bombshop":
                zone = new Zones.Kakariko.Bombshop(game, parent, data);
                break;

            case "kakariko/inn":
                zone = new Zones.Kakariko.Inn(game, parent, data);
                break;

            case "village/village":
                zone = new Zones.Village.Village(game, parent, data);
                break;

            case "village/warehouse":
                zone = new Zones.Village.Warehouse(game, parent, data);
                break;

            case "village/inn":
                zone = new Zones.Village.Inn(game, parent, data);
                break;

            case "village/shop":
                zone = new Zones.Village.Shop(game, parent, data);
                break;

            case "coliseum/cell":
                zone = new Zones.Coliseum.Cell(game, parent, data);
                break;

            case "coliseum/halls-south":
                zone = new Zones.Coliseum.HallsSouth(game, parent, data);
                break;

            case "coliseum/halls-north":
                zone = new Zones.Coliseum.HallsNorth(game, parent, data);
                break;

            case "coliseum/halls-east":
                zone = new Zones.Coliseum.HallsEast(game, parent, data);
                break;

            default:
                throw new ZoneException(String.Format("Unable to generate unknown zone '{0}'.", name));
            }

            zone.Key = name;
            return(zone);
        }
Example #3
0
        public Village(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Desert Village";
            SandbagImage = "Zones/Village/Village/sandbag";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);

            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/village"));

            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/inn")
            {
                X = 840, Y = 1372, DrawOrder = 1752
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/warehouse")
            {
                X = 155, Y = 1300, DrawOrder = 1918
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/well")
            {
                X = 1400, Y = 863, DrawOrder = 977
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/Posts1")
            {
                X = 70, Y = 1940, DrawOrder = 2100
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/house")
            {
                X = 754, Y = 701, DrawOrder = 1094
            });

            Objects.Add(new InteractiveObject {
                Interact = SimpleDoor("village/shop", "village"), Location = new Rectangle(164 * 6, 192 * 6, 80, 40)
            });

            Doors.Add(new Door {
                Location = new Rectangle(1442, 2057, 171, 37), Name = "coliseum", Orientation = Direction.Up, Zone = "coliseum/halls-north", ZoneDoor = "village"
            });

            Doors.Add(new Door {
                Location = new Rectangle(69 * 6, 315 * 6, 9 * 6, 2), Name = "warehouse", Orientation = Direction.Down, Zone = "village/warehouse", ZoneDoor = "entrance"
            });
            Doors.Add(new Door {
                Location = new Rectangle(69 * 6, 320 * 6, 9 * 6, 2), Name = "warehouse exit", Orientation = Direction.Down
            });

            Doors.Add(new Door {
                Location = new Rectangle(177 * 6, 288 * 6, 12 * 6, 2), Name = "inn", Orientation = Direction.Down, Zone = "village/inn", ZoneDoor = "entrance"
            });
            Doors.Add(new Door {
                Location = new Rectangle(177 * 6, 295 * 6, 12 * 6, 2), Name = "inn exit", Orientation = Direction.Down
            });
            Doors.Add(new Door {
                Location = new Rectangle(164 * 6, 200 * 6, 80, 40), Name = "shop", Orientation = Direction.Down
            });
        }
Example #4
0
        public HallsEast(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name = "Coliseum Halls East";
            SandbagImage = "Zones/Coliseum/Halls/east-sb";
            Sandbag = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Halls/east"));

            Doors.Add(new Door {Location = new Rectangle(60, 450, 35, 50), Name = "halls-south", Orientation = Direction.Right });

            Objects.Add(new InteractiveObject { Interact = SimpleDoor("coliseum/halls-south", "halls-east"), Location = new Rectangle(50, 450, 15, 50) });
        }
Example #5
0
        public Warehouse(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Village Warehouse";
            SandbagImage = "Zones/Village/Warehouse/sandbag";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);

            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Warehouse/warehouse"));

            Doors.Add(new Door {
                Location = new Rectangle(56 * 6, 130 * 6, 10 * 6, 1), Name = "entrance", Orientation = Direction.Up, Zone = "village/village", ZoneDoor = "warehouse exit"
            });
        }
Example #6
0
        public KeyboardInput(Torch.Scene scene, Torch.Object parent) : base(scene, parent)
        {
            var keyboard = ((InputManager)scene.Game.Services.GetService(typeof(IInputService))).GetKeyboard();

            keyboard.KeyPressed += HandleKeyDown;

            _controls.Add("left", Keys.A);
            _controls.Add("right", Keys.D);
            _controls.Add("up", Keys.W);
            _controls.Add("down", Keys.S);
            _controls.Add("party menu", Keys.Tab);
            _controls.Add("config menu", Keys.Escape);
            _controls.Add("interact", Keys.E);
        }
Example #7
0
        public BattleBoardLayer(Torch.Scene scene, Torch.Object parent) : base(scene, parent)
        {
            _gui = new GuiManager(
                (GraphicsDeviceManager)Game.Services.GetService(typeof(IGraphicsDeviceManager)),
                (IInputService)Game.Services.GetService(typeof(IInputService))
                );
            _gui.DrawOrder = 0;
            _gui.Initialize();

            _gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
            ((FlatGuiVisualizer)_gui.Visualizer).RendererRepository.AddAssembly(typeof(FlatGridCellControlRenderer).Assembly);

            Components.Add(_gui);

            ((IInputService)Game.Services.GetService(typeof(IInputService))).GetMouse().MouseButtonPressed += OnMouseButtonPressed;
        }
Example #8
0
        public Inn(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Village Inn";
            SandbagImage = "Zones/Village/Inn/sandbag";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Inn/inn"));
            Doors.Add(new Door {
                Location = new Rectangle(63 * 6, 93 * 6, 13 * 6, 2), Zone = "village/village", ZoneDoor = "inn exit", Name = "entrance", Orientation = Direction.Up
            });
            Doors.Add(new Door {
                Location = new Rectangle(215, 265, 75, 75), Name = "save", Orientation = Direction.Down
            });

            AddSavepoint(215, 265);
        }
Example #9
0
        public Shop(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Village Shop";
            SandbagImage = "Zones/Village/Shop/sandbag";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);

            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Shop/shop"));

            Objects.Add(new InteractiveObject {
                Interact = Merchant, Location = new Rectangle(47 * 6, 44 * 6, 8 * 6, 6)
            });

            Doors.Add(new Door {
                Location = new Rectangle(33 * 6, 67 * 6, 8 * 6, 6), Name = "village", Orientation = Direction.Up, Zone = "village/village", ZoneDoor = "shop"
            });
        }
Example #10
0
        public Bombshop(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name = "Kakariko Shop";
            SandbagImage = "Zones/Kakariko/Bombshop/sandbag";
            Sandbag = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers = new List<ImageObject>
                {
                    new ImageObject(Game, parent, "Zones/Kakariko/Bombshop/bombshop") {DrawOrder = -1},
                };

            Objects = new List<InteractiveObject>();

            Doors = new List<Door>
                {
                    new Door { Location = new Rectangle(264, 457, 48, 14), Name = "entrance", Orientation = Direction.Up, Zone = "kakariko/village", ZoneDoor = "bombshop" }
                };
        }
Example #11
0
        public Inn(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Kakariko Inn";
            SandbagImage = "Zones/Kakariko/Inn/sandbag";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers  = new List <ImageObject>
            {
                new ImageObject(Game, parent, "Zones/Kakariko/Inn/inn")
                {
                    DrawOrder = -1
                },
            };

            Objects = new List <InteractiveObject>();

            Doors = new List <Door>
            {
                new Door {
                    Location = new Rectangle(258, 456, 59, 23), Name = "entrance", Orientation = Direction.Up, Zone = "kakariko/village", ZoneDoor = "inn"
                }
            };
        }
Example #12
0
        public CreditSlide(Torch.Scene scene, Torch.Object parent) : base(scene, parent)
        {
            var font = FontManager.Get("Menu");

            Components.Add(new TextObject(Game, this)
            {
                Font      = font,
                Color     = Color.White,
                Value     = "Steve Phillips",
                Alignment = TextObject.AlignTypes.Center,
                X         = Game.GraphicsDevice.Viewport.Width / 2,
                Y         = Game.GraphicsDevice.Viewport.Height / 2 - 25
            });

            Components.Add(new TextObject(Game, this)
            {
                Font      = font,
                Color     = Color.White,
                Value     = "George Emond",
                Alignment = TextObject.AlignTypes.Center,
                X         = Game.GraphicsDevice.Viewport.Width / 2,
                Y         = Game.GraphicsDevice.Viewport.Height / 2 + 25
            });
        }
Example #13
0
 public XnaSlide(Torch.Scene scene, Torch.Object parent) : base(scene, parent)
 {
 }
Example #14
0
        public static Avatar GenerateAvatar(Game game, Torch.Object parent, string className)
        {
            Avatar character;

            int spriteWidth;
            int spriteHeight;

            switch (className)
            {
            case "fighter":
                spriteWidth  = 50;
                spriteHeight = 100;
                character    = new Avatar(game)
                {
                    Sprite     = new SpriteObject(game, parent, "Characters/fighter"),
                    FeetWidth  = 40,
                    FeetHeight = 25
                };
                character.Sprite.AddAnimation("walking down", new SpriteAnimation {
                    FrameCount = 6, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, StartCol = 51, FrameRate = 12
                });
                character.Sprite.AddAnimation("standing down", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking up", new SpriteAnimation {
                    FrameCount = 6, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, StartCol = 51, FrameRate = 12
                });
                character.Sprite.AddAnimation("standing up", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking left", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, FrameRate = 12
                });
                character.Sprite.AddAnimation("standing left", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking right", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, FrameRate = 12
                });
                character.Sprite.AddAnimation("standing right", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, FrameRate = 1
                });
                character.Sprite.SetAnimation("standing down");
                break;

            case "ranger":
                spriteWidth  = 50;
                spriteHeight = 100;
                character    = new Avatar(game)
                {
                    Sprite     = new SpriteObject(game, parent, "Characters/Ranger"),
                    FeetWidth  = 40,
                    FeetHeight = 25
                };
                character.Sprite.AddAnimation("walking down", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing down", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking up", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing up", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking left", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing left", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking right", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing right", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, FrameRate = 1
                });
                character.Sprite.SetAnimation("standing down");
                break;

            case "cleric":
                spriteWidth  = 50;
                spriteHeight = 100;
                character    = new Avatar(game)
                {
                    Sprite     = new SpriteObject(game, parent, "Characters/cleric"),
                    FeetWidth  = 40,
                    FeetHeight = 25
                };
                character.Sprite.AddAnimation("walking down", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 0, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing down", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 0, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking up", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 100, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing up", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 100, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking left", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 200, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing left", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 200, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking right", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 300, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing right", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 300, FrameRate = 1
                });
                character.Sprite.SetAnimation("standing down");
                break;

            case "wizard":
                spriteWidth  = 50;
                spriteHeight = 100;
                character    = new Avatar(game)
                {
                    Sprite     = new SpriteObject(game, parent, "Characters/wizard"),
                    FeetWidth  = 40,
                    FeetHeight = 25
                };
                character.Sprite.AddAnimation("walking down", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing down", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking up", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing up", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking left", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing left", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking right", new SpriteAnimation {
                    FrameCount = 7, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing right", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, FrameRate = 1
                });
                character.Sprite.SetAnimation("standing down");
                break;

            case "monk":
                spriteWidth  = 65;
                spriteHeight = 75;
                character    = new Avatar(game)
                {
                    Sprite     = new SpriteObject(game, parent, "Characters/TempMonk"),
                    FeetWidth  = 40,
                    FeetHeight = 25
                };
                character.Sprite.AddAnimation("walking down", new SpriteAnimation {
                    FrameCount = 8, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing down", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking up", new SpriteAnimation {
                    FrameCount = 8, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 76, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing up", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 76, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking left", new SpriteAnimation {
                    FrameCount = 8, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 151, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing left", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 151, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking right", new SpriteAnimation {
                    FrameCount = 8, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 226, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing right", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 226, FrameRate = 1
                });
                character.Sprite.SetAnimation("standing down");
                break;

            case "enemy":
                spriteWidth  = 50;
                spriteHeight = 100;
                character    = new Avatar(game)
                {
                    Sprite     = new SpriteObject(game, parent, "Characters/guard"),
                    FeetWidth  = 40,
                    FeetHeight = 25
                };
                character.Sprite.AddAnimation("walking down", new SpriteAnimation {
                    FrameCount = 6, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, StartCol = 50, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing down", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 1, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking up", new SpriteAnimation {
                    FrameCount = 6, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, StartCol = 50, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing up", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 101, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking left", new SpriteAnimation {
                    FrameCount = 6, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, StartCol = 50, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing left", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 201, FrameRate = 1
                });
                character.Sprite.AddAnimation("walking right", new SpriteAnimation {
                    FrameCount = 6, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, StartCol = 50, FrameRate = 8
                });
                character.Sprite.AddAnimation("standing right", new SpriteAnimation {
                    FrameCount = 1, Size = new Rectangle(0, 0, spriteWidth, spriteHeight), StartRow = 301, FrameRate = 1
                });
                character.Sprite.SetAnimation("standing down");
                break;

            default:
                throw new Exception(string.Format("unknown avatar {0}", className));
            }

            return(character);
        }
Example #15
0
        public Cell(Game game, Torch.Object parent, byte[] data) : base(game, data)
        {
            Name         = "Coliseum Slave Cells";
            SandbagImage = "Zones/Coliseum/Cell/sandbag";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Cell/cell"));
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Cell/bars")
            {
                X = 50, Y = 300, DrawOrder = 350
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Cell/bars")
            {
                X = 50, Y = 500, DrawOrder = 550
            });
            Doors.Add(new Door {
                Location = new Rectangle(100, 650, 7 * 6, 8 * 6), Name = "bed", Orientation = Direction.Right
            });
            Doors.Add(new Door {
                Location = new Rectangle(905, 200, 45, 25), Name = "halls", Orientation = Direction.Down
            });

            Objects.Add(new InteractiveObject {
                Interact = SimpleDoor("coliseum/halls-south", "cell"), Location = new Rectangle(905, 190, 45, 15)
            });
#if DEBUG
            Objects.Add(new InteractiveObject
            {
                Interact = TestBattle("coliseum/halls"), Location = new Rectangle(230, 550, 10, 50)
            });
#endif
            var propsSprite = new SpriteObject(Game, parent, "Zones/Coliseum/Cell/props");
            propsSprite.AddAnimation("barrel1", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 41, 51), StartRow = 63, StartCol = 99
            });
            propsSprite.AddAnimation("barrel2", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 41, 50), StartRow = 63, StartCol = 140
            });
            propsSprite.AddAnimation("bed1", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 94, 50), StartRow = 0, StartCol = 161
            });
            propsSprite.AddAnimation("bed1-r", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 94, 50), StartRow = 0, StartCol = 161
            });
            propsSprite.AddAnimation("bed2", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 47, 87), StartRow = 0, StartCol = 52
            });
            propsSprite.AddAnimation("bone", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 29, 16), StartRow = 95, StartCol = 0
            });
            propsSprite.AddAnimation("boots", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 33, 33), StartRow = 50, StartCol = 218
            });
            propsSprite.AddAnimation("bucket", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 30, 34), StartRow = 83, StartCol = 218
            });
            propsSprite.AddAnimation("chest1", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 52, 95), StartRow = 0, StartCol = 0
            });
            propsSprite.AddAnimation("pillar", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 62, 63), StartRow = 0, StartCol = 99
            });
            propsSprite.AddAnimation("skull", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 30, 28), StartRow = 87, StartCol = 52
            });
            propsSprite.AddAnimation("stool", new SpriteAnimation {
                FrameRate = 1, FrameCount = 1, Size = new Rectangle(0, 0, 37, 36), StartRow = 50, StartCol = 181
            });

            // bottom left room props
            ImageLayers.Add(propsSprite.Clone("bed2", 50, 550, 550));
            ImageLayers.Add(propsSprite.Clone("bed1-r", 145, 700, 150));
            ImageLayers.Add(propsSprite.Clone("bucket", 60, 700, 60));
            ImageLayers.Add(propsSprite.Clone("stool", 175, 640, 60));

            // bottom middle room props
            ImageLayers.Add(propsSprite.Clone("bed2", 260, 550, 550));
            ImageLayers.Add(propsSprite.Clone("bed2", 440, 550, 550));
            ImageLayers.Add(propsSprite.Clone("bucket", 270, 700, 270));
            ImageLayers.Add(propsSprite.Clone("boots", 450, 640, 270));

            // bottom right room props
            ImageLayers.Add(propsSprite.Clone("bed2", 510, 550, 550));
            ImageLayers.Add(propsSprite.Clone("bed1-r", 515, 700, 150));
            ImageLayers.Add(propsSprite.Clone("skull", 665, 710, 60));
            ImageLayers.Add(propsSprite.Clone("bucket", 655, 660, 60));

            // top left room props
            ImageLayers.Add(propsSprite.Clone("bed2", 50, 100, 100));
            ImageLayers.Add(propsSprite.Clone("bed1-r", 50, 300, 150));
            ImageLayers.Add(propsSprite.Clone("bucket", 200, 100, 150));

            // top middle room props
            ImageLayers.Add(propsSprite.Clone("bed2", 260, 100, 100));
            ImageLayers.Add(propsSprite.Clone("bed2", 440, 100, 100));
            ImageLayers.Add(propsSprite.Clone("bucket", 270, 250, 270));
            ImageLayers.Add(propsSprite.Clone("boots", 450, 190, 190));

            // top right room props
            ImageLayers.Add(propsSprite.Clone("barrel1", 650, 100, 100));
            ImageLayers.Add(propsSprite.Clone("bed1", 515, 100, 100));

            // outside the cells
            ImageLayers.Add(propsSprite.Clone("chest1", 50, 380, 50));

            Characters.Add("guard", Avatar.GenerateAvatar(game, null, "enemy"));

            if (data.Length == 0)
            {
                data = new byte[1];
            }

            if (data[0] == 0x00)
            {
                Characters["guard"].Location.X = 150;
                Characters["guard"].Location.Y = 440;
            }
            else
            {
                Characters["guard"].Location.X = 97;
                Characters["guard"].Location.Y = 440;
                Characters["guard"].UpdateVelocity(1, 0);
                Characters["guard"].UpdateVelocity(0, 0);

                _guardMoved = true;
            }

            Characters["guard"].Interact = TalkToGuard;
        }
Example #16
0
 public Environment(Torch.Scene scene, Torch.Object parent) : base(scene, parent)
 {
 }
Example #17
0
 public HUD(Torch.Scene scene, Torch.Object parent) : base(scene, parent)
 {
     _interactIcon = new ImageObject(Game, this, "HUD/interacticon");
 }
Example #18
0
        public Village(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Kakariko Village";
            SandbagImage = "Zones/Kakariko/village/sandbag";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers  = new List <ImageObject>
            {
                new ImageObject(Game, parent, "Zones/Kakariko/Village/village")
                {
                    DrawOrder = -1
                },
                new ImageObject(Game, parent, "Zones/Kakariko/Village/arch")
                {
                    X = 2568, Y = 2784, DrawOrder = 2925
                },
                new ImageObject(Game, parent, "Zones/Kakariko/Village/house_1")
                {
                    X = 1728, Y = 336, DrawOrder = 587
                },
                new ImageObject(Game, parent, "Zones/Kakariko/Village/mailbox")
                {
                    X = 483, Y = 1152, DrawOrder = 1224
                },
                new ImageObject(Game, parent, "Zones/Kakariko/Village/cave")
                {
                    X = 534, Y = 565, DrawOrder = 660
                },
                new ImageObject(Game, parent, "Zones/Kakariko/Village/bombshop")
                {
                    X = 240, Y = 2544, DrawOrder = 2750
                },
            };

            Objects = new List <InteractiveObject>();

            // mailbox
            var obj = new InteractiveObject {
                Location = new Rectangle(486, 1200, 36, 24)
            };

            obj.Interact += SimpleDialog("kakariko/town", "mailbox");
            Objects.Add(obj);

            // statue
            obj = new InteractiveObject {
                Location = new Rectangle(1512, 1224, 96, 96)
            };
            obj.Interact += SimpleDialog("kakariko/town", "statue");
            Objects.Add(obj);

            // cliff
            obj = new InteractiveObject {
                Location = new Rectangle(268, 445, 312 - 268, 5)
            };
            obj.Interact += SimpleDialog("kakariko/town", "cliff");
            Objects.Add(obj);

            // inn
            obj = new InteractiveObject {
                Location = new Rectangle(1895, 2009, 48, 7)
            };
            obj.Interact += SimpleDoor("kakariko/inn", "entrance");
            Objects.Add(obj);

            // merchant
            obj = new InteractiveObject {
                Location = new Rectangle(1941, 2736, 54, 12)
            };
            obj.Interact += SimpleMerchant("kakariko/town", "merchant");
            Objects.Add(obj);

            Doors = new List <Door>
            {
                new Door {
                    Location = new Rectangle(312, 2725, 48, 8), Name = "bombshop", Orientation = Direction.Down, Zone = "kakariko/bombshop", ZoneDoor = "entrance"
                },
                new Door {
                    Location = new Rectangle(2664, 2997, 48, 32), Name = "arch", Orientation = Direction.Up
                },
                new Door {
                    Location = new Rectangle(1895, 2030, 48, 7), Name = "inn", Orientation = Direction.Down
                }
            };
        }