public Hero(Texture2D texture, Texture2D NormalTexture) : base(NormalTexture) { _isJumping = true; _hasDied = false; _hasWon = false; _spriteEffect = SpriteEffects.None; _heroTexture = texture; _lastKeyPressed = Keys.Right; #region add frames to animation animationJumping = new Animatie(); animationJumping.addFrame(new AnimationFrame(new Rectangle(0, 0, 72, 90))); animationStanding = new Animatie(); for (int i = 0; i < 217; i += 72) { animationStanding.addFrame(new AnimationFrame(new Rectangle(i, 90, 72, 90))); } animationL = new Animatie(); for (int j = 0; j < 361; j += 144) { animationL.addFrame(new AnimationFrame(new Rectangle(j, 180, 72, 90))); } animationR = new Animatie(); for (int k = 0; k < 361; k += 144) { animationR.addFrame(new AnimationFrame(new Rectangle(k, 270, 72, 90))); } #endregion currentAnimation = animationStanding; }
public Enemy(Texture2D texture, Texture2D _normalTexture, Vector2 _position, int _boundryLeft, int _boundryRight) : base(_normalTexture) { EnemyTexture = texture; _hasDied = false; _spriteEffect = SpriteEffects.None; this.Position = _position; this._boundryLeft = _boundryLeft; this._boundryRight = _boundryRight; Velocity.X = 3; _dir = 3; _animationRunning = new Animatie(); for (int j = 0; j < 471; j += 94) { _animationRunning.addFrame(new AnimationFrame(new Rectangle(j, 0, 94, 90))); } }