/// <summary> /// Creates the initial values for all reference variables in our Player. /// </summary> public void Initialize() { Position = Vector2.Zero; Velocity = Vector2.Zero; Box = new HitBox((int)Position.X, (int)Position.Y, PLAYER_WIDTH, PLAYER_HEIGHT, 0); MaxHorizontalSpeed = 6; HorizontalAcceleration = 0.75f; StaticFriction = 0.9f; HorizontalDrag = 0.9f; MaxFallSpeed = 10; GravitationalAcceleration = 0.5f; JumpHeight = 12; ResetKnowledge(); }
/// <summary> /// Removes a HitBox from this GridPiece. /// </summary> /// <param name="b"></param> public void RemoveHitBox(HitBox b) { HitBoxes.Remove(b); }
/// <summary> /// Check if this HitBox hits another HitBox. /// </summary> /// <param name="b">The Other Hitbox.</param> /// <returns></returns> public bool HitTest(HitBox b) { return Rect.Intersects(b.Rect); }
/// <summary> /// Adds a HitBox to this GridPiece. /// </summary> /// <param name="b"></param> public void AddHitBox(HitBox b) { HitBoxes.Add(b); }