public Personnage(Rectangle winsize, Vector2 position) : base(winsize, position, 140, 190, @"game\perso", 15, 4) { _graphicalBounds = new GraphicalBounds<CharacterActions>(new Dictionary<CharacterActions, Rectangle>()); _graphicalBounds.set(CharacterActions.WalkRight, 3, 6, 15); _graphicalBounds.set(CharacterActions.WalkLeft, 18, 21, 30); _graphicalBounds.set(CharacterActions.StandRight, 1, 1, 2, 4); _graphicalBounds.set(CharacterActions.StandLeft, 16, 16, 17, 4); _graphicalBounds.set(CharacterActions.JumpRight, 31, 31, 35); _graphicalBounds.set(CharacterActions.JumpLeft, 36, 36, 40); _graphicalBounds.set(CharacterActions.Attack1Right, 41, 41, 49, 35); _graphicalBounds.set(CharacterActions.Attack1Left, 50, 50, 58, 35); _graphicalBounds.set(CharacterActions.AttackStunRight, 1, 1, 2, 4); _graphicalBounds.set(CharacterActions.AttackStunLeft, 16, 16, 17, 4); _graphicalBounds.set(CharacterActions.ReceiveAttackRight, 60, 60, 60); _graphicalBounds.set(CharacterActions.ReceiveAttackLeft, 59, 59, 59); Action = CharacterActions.StandRight; _physics.MaxHeight = 400; _physics.TimeOnFlat = 500; _inputManager = new InputManager<KeysActions, Keys>(); Weapon = new Weapon(winsize, @"game/weapon", _sprite.Lignes, _sprite.Colonnes, _sprite.Position.Width, _sprite.Position.Height); InitKeys(); actualizeSpriteGraphicalBounds(); actualizeSpritePosition(); Jump(); Mana = 1; _experience = new ExperienceCounter(ExperienceCounter.Growth.Cuadratic); AddAttack(CharacterActions.AttackStunLeft, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 400, 400), _windowSize, "sprites/expl_spread_6x6", 6, 6, 30, 1, 32, 1, true), 1500, 0.001f, 3000, 1000, 0.3f)); AddAttack(CharacterActions.AttackStunRight, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 400, 400), _windowSize, "sprites/expl_spread_6x6", 6, 6, 30, 1, 32, 1, true), 1500, 0.001f, 3000, 1000, 0.3f)); AddAttack(CharacterActions.Attack1Right, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 10, 10), _windowSize, "general/vide"), 50, 0.1f, 500, 400, 0.1f)); AddAttack(CharacterActions.Attack1Left, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 10, 10), _windowSize, "general/vide"), 50, 0.1f, 500, 400, 0.1f)); }
public Character(Rectangle winSize, Vector2 position, int width, int height, string assetName, int textureColumns, int textureLines) { _windowSize = winSize; _position = position; _graphicalBounds = new GraphicalBounds<CharacterActions>(new Dictionary<CharacterActions, Rectangle>()); _sprite = new AnimatedSprite(new Rectangle((int)position.X - width / 2, (int)position.Y - height, width, height), winSize, assetName, textureColumns, textureLines, 30, 1, -1, -1, true); _canMove = true; _jumping = false; _jumpHeight = 0; _direction = true; // = right _timer = 0; _physics = new Physics(); Life = 1; _action = CharacterActions.StandRight; _attacks = new Dictionary<CharacterActions, Attack>(); }
public Character(Rectangle winSize, Vector2 position, int width, int height, string assetName, int textureColumns, int textureLines) { this._windowSize = winSize; this._position = position; Damage = 1; this._weapons = new List<Weapon>(); this._graphicalBounds = new GraphicalBounds<CharacterActions>(new Dictionary<CharacterActions, Rectangle>()); this._sprite = new AnimatedSprite(new Rectangle((int)position.X - width / 2, (int)position.Y - height, width, height), winSize, assetName, textureColumns, textureLines, 30, 1, -1, -1, true); this._canMove = true; this._jumping = false; this._jumpHeight = 0; this._direction = true; this._timer = 0; this._physics = new Physics(200, 1000); this.Life = 1f; this._action = CharacterActions.StandRight; this._attacks = new Dictionary<CharacterActions, Attack>(); Armor = 1; CanBeStunned = true; }