public Sprite End()
 {
     Sprite temp = spriteBegin;
     sprite = null;
     spriteBegin = null;
     return temp;
 }
示例#2
0
 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public Sprite()
 {
     this.image			= null;
     this.sourceRect		= Rectangle2I.Zero;
     this.drawOffset		= Point2I.Zero;
     this.nextPart		= null;
 }
示例#3
0
        public Animation(Sprite sprite)
        {
            this.frames		= new List<AnimationFrame>();
            this.duration	= 0;
            this.nextStrip	= null;
            this.loopMode	= LoopMode.Repeat;

            this.frames.Add(new AnimationFrame(0, 0, sprite));
        }
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public DungeonMapRoom()
 {
     this.floor			= null;
     this.room			= null;
     this.hasTreasure	= false;
     this.isBossRoom		= false;
     this.sprite			= null;
     this.isDiscovered	= false;
     this.location		= Point2I.Zero;
 }
        private float timer; // The playback time in ticks.

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public AnimationPlayer()
        {
            sprite			= null;
            animation		= null;
            subStrip		= null;
            subStripIndex	= 0;
            isPlaying		= false;
            timer			= 0.0f;
            speed			= 1.0f;
        }
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public RewardRecoveryHeart(string id, int amount, string message, Sprite sprite)
        {
            this.id				= id;
            this.animation		= new Animation(sprite);
            this.message		= message;
            this.hasDuration	= true;
            this.holdType		= RewardHoldTypes.Raise;
            this.isCollectibleWithItems	= true;

            this.amount			= amount;
        }
示例#7
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public EventTileData()
        {
            type				= null;
            sprite				= null;
            position			= Point2I.Zero;
            size				= Point2I.One;
            properties			= new Properties();

            properties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this event.", true, false);
        }
 public static void DrawSprite(Graphics g, Sprite sprite, int variantID, int x, int y)
 {
     for (Sprite part = sprite; part != null; part = part.NextPart) {
         Bitmap bitmap = EditorResources.GetBitmap(part.Image.GetVariant(variantID));
         Rectangle sourceRect = new Rectangle(
             part.SourceRect.X, part.SourceRect.Y,
             part.SourceRect.Width, part.SourceRect.Height);
         g.DrawImage(bitmap, x + part.DrawOffset.X,
             y + part.DrawOffset.Y, sourceRect, GraphicsUnit.Pixel);
     }
 }
示例#9
0
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public Ammo(string id, string name, string description, Sprite sprite, int amount, int maxAmount)
 {
     this.id				= id;
     this.name			= name;
     this.description	= description;
     this.amount			= amount;
     this.maxAmount		= maxAmount;
     this.sprite			= sprite;
     this.isObtained		= false;
     this.isStolen		= false;
 }
示例#10
0
 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public RewardRupee(string id, int amount, string message, Sprite sprite)
 {
     this.id				= id;
     this.amount			= amount;
     this.message		= message;
     this.animation		= new Animation(sprite);
     this.hasDuration	= true;
     this.holdType		= RewardHoldTypes.Raise;
     this.isCollectibleWithItems	= true;
     this.onlyShowMessageInChest = true;
 }
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public RewardRecoveryHeart(string id, int amount, string message, Sprite sprite)
        {
            InitSprite(sprite);

            this.id				= id;
            this.message		= message;
            this.hasDuration	= true;
            this.holdType		= RewardHoldTypes.Raise;
            this.isCollectibleWithItems	= true;
            this.onlyShowMessageInChest = true;

            this.amount			= amount;
        }
示例#12
0
 public Sprite(SpriteSheet sheet, Point2I index, Point2I drawOffset)
 {
     this.image			= sheet.Image;
     this.sourceRect		= new Rectangle2I(
         sheet.Offset.X + (index.X * (sheet.CellSize.X + sheet.Spacing.X)),
         sheet.Offset.Y + (index.Y * (sheet.CellSize.Y + sheet.Spacing.Y)),
         sheet.CellSize.X,
         sheet.CellSize.Y
     );
     this.drawOffset		= new Point2I(drawOffset.X, drawOffset.Y);
     this.image			= sheet.Image;
     this.nextPart		= null;
 }
示例#13
0
        //-----------------------------------------------------------------------------
        // Slots
        //-----------------------------------------------------------------------------
        public virtual void DrawSlotCursor(Graphics2D g, Slot slot)
        {
            Sprite tR = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(9, 0));
            Sprite bR = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(9, 1));
            Sprite tL = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(10, 0));
            Sprite bL = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(10, 1));

            g.DrawSprite(tR, slot.Position + new Point2I(-8, 0));
            g.DrawSprite(bR, slot.Position + new Point2I(-8, 8));

            g.DrawSprite(tL, slot.Position + new Point2I(slot.Width, 0));
            g.DrawSprite(bL, slot.Position + new Point2I(slot.Width, 8));
        }
示例#14
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemSword()
        {
            this.id				= "item_sword";
            this.name			= new string[] { "Wooden Sword", "Noble Sword", "Master Sword" };
            this.description	= new string[] { "A hero's blade.", "A sacred blade.", "The blade of legends." };
            this.maxLevel		= Item.Level3;
            this.flags			= ItemFlags.UsableInMinecart | ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword;

            sprite = new Sprite[] {
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(0, 0)),
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(1, 0)),
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(2, 0))
            };
        }
示例#15
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBracelet(int level = 0)
        {
            this.id				= "item_bracelet";
            this.name			= new string[] { "Power Bracelet", "Power Gloves" };
            this.description	= new string[] { "A strength booster.", "Used to lift large objects." };
            this.level			= level;
            this.maxLevel		= 1;
            this.flags			= ItemFlags.None;

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_BRACELET,
                GameData.SPR_ITEM_ICON_POWER_GLOVES
            };
        }
示例#16
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBoomerang()
        {
            this.id				= "item_boomerang";
            this.name			= new string[] { "Boomerang", "Magic Boomerang" };
            this.description	= new string[] { "Always comes back to you.", "A remote-control weapon." };
            this.level			= 0;
            this.maxLevel		= Item.Level2;
            this.flags			= ItemFlags.UsableInMinecart | ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword;

            sprite = new Sprite[] {
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(4, 1)),
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(5, 1))
            };
        }
示例#17
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemSwitchHook()
        {
            this.id				= "item_switch_hook";
            this.name			= new string[] { "Switch Hook", "Long Hook" };
            this.description	= new string[] { "User and target trade places.", "Switches places from a distance." };
            this.level			= 0;
            this.maxLevel		= Item.Level2;
            this.flags			= ItemFlags.UsableWithSword;

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_SWITCH_HOOK,
                GameData.SPR_ITEM_ICON_SWITCH_HOOK
            };
        }
示例#18
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemFeather(int level = 0)
        {
            this.id				= "item_feather";
            this.name			= new string[] { "Roc's Feather", "Roc's Cape" };
            this.description	= new string[] { "A nice lift.", "A wing-riding cape." };
            this.level			= level;
            this.maxLevel		= Item.Level2;
            this.flags			= ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword;

            sprite = new Sprite[] {
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(2, 1)),
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(3, 1))
            };
        }
示例#19
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemFeather(int level = 0)
        {
            this.id				= "item_feather";
            this.name			= new string[] { "Roc's Feather", "Roc's Cape" };
            this.description	= new string[] { "A nice lift.", "A wing-riding cape." };
            this.level			= level;
            this.maxLevel		= Item.Level2;
            this.flags			= ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword;

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_FEATHER,
                GameData.SPR_ITEM_ICON_CAPE
            };
        }
示例#20
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemSword()
        {
            this.id				= "item_sword";
            this.name			= new string[] { "Wooden Sword", "Noble Sword", "Master Sword" };
            this.description	= new string[] { "A hero's blade.", "A sacred blade.", "The blade of legends." };
            this.maxLevel		= Item.Level3;
            this.flags			= ItemFlags.UsableInMinecart | ItemFlags.UsableWhileJumping | ItemFlags.UsableWhileInHole;
            this.beamTracker	= new EntityTracker<SwordBeam>(1);

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_SWORD_1,
                GameData.SPR_ITEM_ICON_SWORD_2,
                GameData.SPR_ITEM_ICON_SWORD_3
            };
        }
示例#21
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBow()
        {
            this.id				= "item_bow";
            this.name			= new string[] { "Wooden Bow", "Wooden Bow", "Wooden Bow" };
            this.description	= new string[] { "Weapon of a marksman.", "Weapon of a marksman.", "Weapon of a marksman." };
            this.maxLevel		= Item.Level3;
            this.currentAmmo	= 0;
            this.flags			= ItemFlags.UsableInMinecart | ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword;

            sprite = new Sprite[] {
                new Sprite(GameData.SHEET_ITEMS_SMALL, 13, 1),
                new Sprite(GameData.SHEET_ITEMS_SMALL, 13, 1),
                new Sprite(GameData.SHEET_ITEMS_SMALL, 13, 1)
            };
        }
示例#22
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBoomerang()
        {
            this.id				= "item_boomerang";
            this.name			= new string[] { "Boomerang", "Magic Boomerang" };
            this.description	= new string[] { "Always comes back to you.", "A remote-control weapon." };
            this.level			= 0;
            this.maxLevel		= Item.Level2;
            this.flags			= ItemFlags.UsableInMinecart | ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword | ItemFlags.UsableWhileInHole;
            this.boomerangTracker	= new EntityTracker<Boomerang>(1);

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_BOOMERANG_1,
                GameData.SPR_ITEM_ICON_BOOMERANG_2
            };
        }
示例#23
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBow()
        {
            this.id				= "item_bow";
            this.name			= new string[] { "Wooden Bow", "Wooden Bow", "Wooden Bow" };
            this.description	= new string[] { "Weapon of a marksman.", "Weapon of a marksman.", "Weapon of a marksman." };
            this.maxLevel		= Item.Level3;
            this.currentAmmo	= 0;
            this.flags			= ItemFlags.UsableInMinecart | ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword | ItemFlags.UsableWhileInHole;
            this.arrowTracker	= new EntityTracker<Arrow>(2);

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_BOW,
                GameData.SPR_ITEM_ICON_BOW,
                GameData.SPR_ITEM_ICON_BOW
            };
        }
示例#24
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBracelet(int level = 0)
        {
            this.id				= "item_bracelet";
            this.name			= new string[] { "Power Bracelet", "Power Gloves" };
            this.description	= new string[] { "A strength booster.", "Used to lift large objects." };
            this.level			= level;
            this.maxLevel		= 1;
            this.flags			= ItemFlags.None;

            sprite = new Sprite[] {
                new Sprite(GameData.SHEET_ITEMS_SMALL, 0, 1),
                new Sprite(GameData.SHEET_ITEMS_SMALL, 1, 1)
            };

            grabState = new PlayerGrabState();
        }
示例#25
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBombs()
        {
            this.id				= "item_bombs";
            this.name			= new string[] { "Bombs", "Bombs", "Bombs" };
            this.description	= new string[] { "Very explosive.", "Very explosive.", "Very explosive." };
            this.maxLevel		= Item.Level3;
            this.currentAmmo	= 0;

            this.flags			= ItemFlags.None;

            sprite = new Sprite[] {
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(13, 0)),
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(13, 0)),
                new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(13, 0))
            };
        }
示例#26
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public RewardAmmo(string id, string ammoID, int amount, string message, Sprite sprite)
        {
            this.id				= id;
            if (sprite.SourceRect.Width == 8 && sprite.DrawOffset.X == 0) {
                sprite = new Sprite(sprite);
                sprite.DrawOffset = new Point2I(4, sprite.DrawOffset.Y);
            }
            this.animation		= new Animation(sprite);
            this.message		= message;
            this.hasDuration	= true;
            this.holdType		= RewardHoldTypes.Raise;
            this.isCollectibleWithItems	= true;

            this.ammoID			= ammoID;
            this.amount			= amount;
        }
示例#27
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public RewardItem(string id, string itemID, int level, RewardHoldTypes holdType, string message, Sprite sprite)
        {
            this.id				= id;
            if (sprite.SourceRect.Width == 8 && sprite.DrawOffset.X == 0) {
                sprite = new Sprite(sprite);
                sprite.DrawOffset = new Point2I(4, sprite.DrawOffset.Y);
            }
            this.animation		= new Animation(sprite);
            this.message		= message;
            this.hasDuration	= true;
            this.holdType		= holdType;
            this.isCollectibleWithItems	= true;

            this.itemID			= itemID;
            this.level			= level;
        }
示例#28
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemBombs()
        {
            this.id				= "item_bombs";
            this.name			= new string[] { "Bombs", "Bombs", "Bombs" };
            this.description	= new string[] { "Very explosive.", "Very explosive.", "Very explosive." };
            this.maxLevel		= Item.Level3;
            this.currentAmmo	= 0;
            this.bombTracker	= new EntityTracker<Bomb>(1);

            this.flags			= ItemFlags.UsableWhileInHole;

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_BOMB,
                GameData.SPR_ITEM_ICON_BOMB,
                GameData.SPR_ITEM_ICON_BOMB,
            };
        }
示例#29
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public EffectUsedItem(Sprite sprite)
            : base()
        {
            // Create an animation of the sprite rising with two key-frames.
            Sprite spr1 = new Sprite(sprite);
            spr1.DrawOffset += new Point2I(-sprite.SourceRect.Width / 2, -12);
            Sprite spr2 = new Sprite(sprite);
            spr2.DrawOffset += new Point2I(-sprite.SourceRect.Width / 2, -20);

            Animation animation = new Animation(LoopMode.Reset);
            animation.AddFrame(0, 8, spr1);
            animation.AddFrame(8, 20, spr2);

            // Play the animation.
            destroyTimer = -1;
            destroyOnAnimationComplete = true;
            Graphics.PlayAnimation(animation);
            Graphics.DepthLayer = DepthLayer.EffectCling; // TODO: proper depth layer for EffectUsedItem
        }
示例#30
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ItemSeedSatchel()
        {
            this.id				= "item_seed_satchel";
            this.name			= new string[] { "Seed Satchel", "Seed Satchel", "Seed Satchel" };
            this.description	= new string[] { "A bag for carrying seeds.", "A bag for carrying seeds.", "A bag for carrying seeds." };
            this.maxLevel		= Item.Level3;
            this.currentAmmo	= 0;
            this.flags			= ItemFlags.UsableInMinecart | ItemFlags.UsableWhileJumping | ItemFlags.UsableWithSword;

            sprite = new Sprite[] {
                GameData.SPR_ITEM_ICON_SATCHEL,
                GameData.SPR_ITEM_ICON_SATCHEL,
                GameData.SPR_ITEM_ICON_SATCHEL,
            };
            spriteEquipped = new Sprite[] {
                GameData.SPR_ITEM_ICON_SATCHEL_EQUIPPED,
                GameData.SPR_ITEM_ICON_SATCHEL_EQUIPPED,
                GameData.SPR_ITEM_ICON_SATCHEL_EQUIPPED,
            };
        }