Exemple #1
0
        public Entity(GameScreen screen, int x, int y, Sprite s, Func <Entity, TileMap, bool> ai,
                      int hp = 75, double ap = 1, int xp = 6, float speed = 1, PossibleDrop[] pDrops = null) : base(s, x, y)
        {
            this.ai   = ai;
            GScreen   = screen;
            Name      = RName.newName();
            bounds    = new EntityBounds(this, x, y, (int)TileMap.SPRITE_SIZE, 12, 14, 6, 24);
            State     = EntityState.Standing;
            msVel     = new Vector2(0, 0);
            facing    = Direction.Right;
            jumpDelay = attackDelay = showHpTicks = 0;
            MAX_SPEED = speedMultiplier = speed;

            XPValue = xp;

            // Stats
            Equipment = new Equipment(this);
            Stats     = new EntityStats(this, hp, (float)ap);

            // Initialize drops, if none given empty array
            this.pDrops = (pDrops == null) ? new PossibleDrop[0] : pDrops;

            // Due to a quirk in the code the frame count here must be one more than actual
            sprite.setFrame(250, 3);
            if (!sprite.hasSpriteParts(SpriteParts.Entity))
            {
                throw new ArgumentException("The sprite passed is not an Entity sprite");
            }
        }
Exemple #2
0
        public Entity(GameScreen screen, Sprite s, int x, int y, int hp, float ap = 1, int xp = 0) : base(screen, s, x, y)
        {
            XPValue = xp;
            facing  = Direction.Right;
            State   = EntityState.Standing;

            Name       = RandomName.newName();
            Properties = new Dictionary <string, bool>();
            Bounds     = new EntityBounds(this, x, y, (int)TileMap.SPRITE_SIZE, 12, 14, 6, 24);

            // Stats
            Equipment = new Equipment(this);
            Stats     = new EntityStats(this, hp, ap);

            commonEntityInit();
        }
Exemple #3
0
        public Entity(GameScreen screen, int x, int y, Sprite s, Func<Entity, TileMap, bool> ai, 
            int hp=75, double ap=1, int xp=6, float speed=1, PossibleDrop[] pDrops=null)
            : base(s, x, y)
        {
            this.ai = ai;
            GScreen = screen;
            Name = RName.newName();
            bounds = new EntityBounds(this, x, y, (int) TileMap.SPRITE_SIZE, 12, 14, 6, 24);
            State = EntityState.Standing;
            msVel = new Vector2(0, 0);
            facing = Direction.Right;
            jumpDelay = attackDelay = showHpTicks = 0;
            MAX_SPEED = speedMultiplier = speed;

            XPValue = xp;

            // Stats
            Equipment = new Equipment(this);
            Stats = new EntityStats(this, hp, (float) ap);

            // Initialize drops, if none given empty array
            this.pDrops = (pDrops == null) ? new PossibleDrop[0] : pDrops;

            // Due to a quirk in the code the frame count here must be one more than actual
            sprite.setFrame(250, 3);
            if (!sprite.hasSpriteParts(SpriteParts.Entity))
                throw new ArgumentException("The sprite passed is not an Entity sprite");
        }