public void Update(IMap map, float seconds) { _map=map; _lastSpeed = _speed; if (changed > 0) changed--; if (_moveVectorSet) { Move(_moveVector.X, _moveVector.Y, true); } if (!wallCollision) _speed.Y += gravity * seconds; if (_speed.X < 0) Left = true; else if (_speed.X > 0) Left = false; if (seconds > 0.1f) if (_speed.Y * seconds > 8) _speed.Y = 8 / seconds; _body.Update(seconds * 1000f); for (int x = 0; x < _attachedAnimations.Count; x++) { if (!_attachedAnimations[x].Update(seconds * 1000f)) { _attachedAnimations.RemoveAt(x); x--; } } if (_onGround && !flying && Math.Abs(_speed.X) > 0 && !wallCollision && (_aniControl.Run.GetFrameNum() == 3 || _aniControl.Run.GetFrameNum() == 0)) { Vector2 pos = _position; pos.Y += Rect.Height; pos.X += Left ? Rect.Width : 0; } wallCollision = false; TryMove(_speed * seconds, map); if (!stunned) _aniControl.Update(seconds * 1000, this); if (wallCollision) { _speed.Y = 0; } #region Animation Handling if (jump) { if (!_onGround && !flying) { jump = false; } } /* else if (_onGround && flying) Land.Update(seconds * 1000); else Run.Update(seconds * 1000); */ if (_aniControl.Jump.GetFrameNum() == 5 && jump) { jump = false; } if (_aniControl.Land.GetFrameNum() == 4 && flying) { flying = false; } #endregion EventObject obj = map.GetEvent(this); if (obj != null) obj.Event(this); if (_targetExp > _exp) { _exp++; if (_exp >= nextLevelExp) { int add = nextLevelExp - lastExp; lastExp = _exp; nextLevelExp += add + add / 3; level++; } } if (_onGround && flying && _aniControl.Land.GetFrameNum() == 0) { } if (_onGround || wallCollision) airstun = false; if (stunTimeout <= 0 && !airstun) stunned = false; _invincibleTime -= seconds; stunTimeout -= seconds; _speed.X = 0; }