Exemple #1
0
        public Player(Game game)
        {
            this.isShooting  = false;
            this.eventCalled = false;
            this.isHit       = false;

            this.health = 100f;
            this.armor  = 0f;

            this.damageTaken = 0f;

            gameRef = game as Game1;
            camera  = new Camera(gameRef.ScreenRectangle);

            this.damageTakenFont = gameRef.DamageTakenFont;
            this.floatDamage     = new FloatTextAnimation();
            floatDamage.TextFont = damageTakenFont;
            this.floatDuration   = 2500f;
        }
Exemple #2
0
        public Enemy(SpriteSheet moveTexture, SpriteSheet deathTexture, SpriteSheet hitTexture, SpriteSheet attackTexture,
                     Vector2 position, Game game, Camera cam)
        {
            this.spriteSheet         = moveTexture.SpriteSheet1;
            this.moveSprite          = BindAnimations(spriteSheet, moveTexture.AnimationFrames);
            this.moveSprite.Position = position;

            this.deathSpriteSheet     = deathTexture.SpriteSheet1;
            this.deathSprite          = BindAnimations(deathSpriteSheet, deathTexture.AnimationFrames);
            this.deathSprite.Position = position;

            this.hitSpriteSheet     = hitTexture.SpriteSheet1;
            this.hitSprite          = BindAnimations(hitSpriteSheet, hitTexture.AnimationFrames);
            this.hitSprite.Position = position;

            this.attackSpriteSheet     = attackTexture.SpriteSheet1;
            this.attackSprite          = BindAnimations(attackSpriteSheet, attackTexture.AnimationFrames);
            this.attackSprite.Position = position;

            this.gameRef     = game as Game1;
            this.camera      = cam;
            this.health      = 100f;
            this.damage      = 10f;
            this.beenHit     = false;
            this.attacking   = false;
            this.eventCalled = false;
            this.visionRange = 300f;

            this.damageTakenFont = gameRef.DamageTakenFont;
            this.floatDamage     = new FloatTextAnimation();
            floatDamage.TextFont = damageTakenFont;
            floatDamage.Color    = Color.WhiteSmoke;
            this.floatDuration   = 2500f;

            this.pathDelayCounter   = 20;
            this.attackDelayCounter = attackTexture.AnimationFrames / 2;
            this.hasAttacked        = false;

            this.removeThisElement = false;
            this.timeOfDeath       = 0.0f;
        }