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 ExperienceCounter(ExperienceCounter.Growth growthType, int firstLevel = 100) { this._growth = growthType; this._last = 0; this._firstLevel = firstLevel; this._toNext = firstLevel; this.Level = 1; }
public Personnage(Rectangle winsize, Vector2 position) : base(winsize, position, 140, 190, "game\\perso", 15, 4) { this._graphicalBounds = new GraphicalBounds<CharacterActions>(new Dictionary<CharacterActions, Rectangle>()); this._graphicalBounds.set(CharacterActions.WalkRight, 3, 6, 15, 30); this._graphicalBounds.set(CharacterActions.WalkLeft, 18, 21, 30, 30); this._graphicalBounds.set(CharacterActions.StandRight, 1, 1, 2, 4); this._graphicalBounds.set(CharacterActions.StandLeft, 16, 16, 17, 4); this._graphicalBounds.set(CharacterActions.JumpRight, 31, 31, 35, 30); this._graphicalBounds.set(CharacterActions.JumpLeft, 36, 36, 40, 30); this._graphicalBounds.set(CharacterActions.Attack1Right, 41, 41, 49, 50); this._graphicalBounds.set(CharacterActions.Attack1Left, 50, 50, 58, 50); this._graphicalBounds.set(CharacterActions.AttackStunRight, 1, 1, 2, 4); this._graphicalBounds.set(CharacterActions.AttackStunLeft, 16, 16, 17, 4); this._graphicalBounds.set(CharacterActions.ReceiveAttackRight, 60, 60, 60, 30); this._graphicalBounds.set(CharacterActions.ReceiveAttackLeft, 59, 59, 59, 30); this._graphicalBounds.set(CharacterActions.Attack2Right, 1, 1, 2, 5); this._graphicalBounds.set(CharacterActions.Attack2Left, 16, 16, 17, 5); this.Action = CharacterActions.StandRight; this._physics.MaxHeight = 400; this._physics.TimeOnFlat = 500; this._inputManager = new InputManager<Personnage.KeysActions, Keys>(); this._weapons.Add(new Weapon(winsize, "game/weapon", this.Sprite.Lignes, this.Sprite.Colonnes, this.Sprite.Position.Width, this.Sprite.Position.Height, 1f)); Enumerable.Last<Weapon>((IEnumerable<Weapon>)this._weapons).Tip = new Tip(this._windowSize, new Rectangle(this._windowSize.Width - 60, this._windowSize.Height - 60, 40, 40), "game/tips/sword2_tip", "SpriteFont1", "x" + this.Weapons[0].Damage.ToString() + " ", Color.Gold); this._weapons.Add(new Weapon(winsize, "game/weapon2", this.Sprite.Lignes, this.Sprite.Colonnes, this.Sprite.Position.Width, this.Sprite.Position.Height, 1.5f)); Enumerable.Last<Weapon>((IEnumerable<Weapon>)this._weapons).Tip = new Tip(this._windowSize, new Rectangle(this._windowSize.Width - 110, this._windowSize.Height - 60, 40, 40), "game/tips/sword3_tip", "SpriteFont1", "x" + this.Weapons[1].Damage.ToString() + " ", Color.Gold); this.Weapon = 0; this.InitKeys(); this.actualizeSpriteGraphicalBounds(); this.actualizeSpritePosition(); this.Jump(); this.Mana = 1f; this._experience = new ExperienceCounter(ExperienceCounter.Growth.Cuadratic, 200); this.AddAttack(CharacterActions.AttackStunLeft, new Attack(this._windowSize, new AnimatedSprite(new Rectangle(0, 0, 400, 400), this._windowSize, "sprites/expl_spread_6x6", 6, 6, 30, 1, 32, 1, true), 1500, 1.0f / 1000.0f, 3000, 400, 0.3f)); this.AddAttack(CharacterActions.AttackStunRight, new Attack(this._windowSize, new AnimatedSprite(new Rectangle(0, 0, 400, 400), this._windowSize, "sprites/expl_spread_6x6", 6, 6, 30, 1, 32, 1, true), 1500, 1.0f / 1000.0f, 3000, 400, 0.3f)); this.AddAttack(CharacterActions.Attack1Right, new Attack(this._windowSize, new AnimatedSprite(new Rectangle(0, 0, 10, 10), this._windowSize, "general/vide", 1, 1, 30, 1, -1, -1, false), 50, 0.1f, 280, 300, 0.05f)); this.AddAttack(CharacterActions.Attack1Left, new Attack(this._windowSize, new AnimatedSprite(new Rectangle(0, 0, 10, 10), this._windowSize, "general/vide", 1, 1, 30, 1, -1, -1, false), 50, 0.1f, 280, 300, 0.05f)); AnimatedSprite a = new AnimatedSprite(new Rectangle(0, 0, 100, 100), this._windowSize, "sprites/distant_attack_5x7", 5, 7, 30, 1, 35, 1, false); a.Direction = new Vector2(-2, 1); a.Vitesse = 0.15f; this.AddAttack(CharacterActions.Attack2Left, new Attack(this._windowSize, a, 2000, 0.05f, 1000, 1000, 0.5f)); a = new AnimatedSprite(new Rectangle(0, 0, 100, 100), this._windowSize, "sprites/distant_attack_5x7", 5, 7, 30, 1, 35, 1, false); a.Direction = new Vector2(2, 1); a.Vitesse = 0.15f; this.AddAttack(CharacterActions.Attack2Right, new Attack(this._windowSize, a, 2000, 0.05f, 1000, 1000, 0.5f)); }