Example #1
0
        protected Player(string name, float x, float y, float width, float height, Direction heading) :
            base(name, x, y, width, height, 1.0f, heading)
        {
            _sprites          = JustCombat.GameContent.FumikoImage;
            _spriteSheet      = new SpriteSheet(_sprites, Constants.PLAYER_WIDTH, Constants.PLAYER_HEIGHT);
            _playerDirections = new Texture2D[4];

            _boundingBox.GetPrimRectangle().SetColor(Color.Green);

            InitStaticDirectionSprites();

            _animatePlayerNorthWalking = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "nWalk", 0, 0, 3, ANIMATION_SPEED_WALKING);
            _animatePlayerEastWalking  = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "eWalk", 0, 1, 3, ANIMATION_SPEED_WALKING);
            _animatePlayerSouthWalking = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "sWalk", 0, 2, 3, ANIMATION_SPEED_WALKING);
            _animatePlayerWestWalking  = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "wWalk", 0, 3, 3, ANIMATION_SPEED_WALKING);

            _animatePlayerNorthRunning = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "nRun", 3, 0, 3, ANIMATION_SPEED_RUNNING);
            _animatePlayerEastRunning  = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "eRun", 3, 1, 3, ANIMATION_SPEED_RUNNING);
            _animatePlayerSouthRunning = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "sRun", 3, 2, 3, ANIMATION_SPEED_RUNNING);
            _animatePlayerWestRunning  = AnimationFactory.CreateAnimationHorizontal(_spriteSheet, "wRun", 3, 3, 3, ANIMATION_SPEED_RUNNING);

            _animatePlayerIdle = AnimationFactory.CreateAnimationIdlePlayer(_spriteSheet, "idle", 16, 0, ANIMATION_SPEED_IDLE);

            _currentAnimation = _animatePlayerIdle;

            _experiencePoints    = 0;
            _maxExperiencePoints = ExperienceSystem.GetExperienceForNextLevel(_level);

            _moving = false;
        }
Example #2
0
 private static void UpdateAttributes()
 {
     _player.SetMaxHitPoints(HitPoints.Calculate(_player));
     _player.SetHitPoints(_player.GetMaxHitPoints());
     _player.SetMaxExperiencePoints(ExperienceSystem.GetExperienceForNextLevel(Player.Instance().GetLevel()));
 }