private static void CheckStopTopBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Top >= borders.Top) { return; } vel.Velocity = new Vector2D(vel.Velocity.X, 0.02f); rect.Top = borders.Top; }
private static void CheckStopBottomBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Bottom <= borders.Bottom) { return; } vel.Velocity = new Vector2D(vel.Velocity.X, -0.02f); rect.Bottom = borders.Bottom; }
private static void CheckStopRightBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Right <= borders.Right) { return; } vel.Velocity = new Vector2D(-0.02f, vel.Velocity.Y); rect.Right = borders.Right; }
private static void CheckStopLeftBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Left >= borders.Left) { return; } vel.Velocity = new Vector2D(0.02f, vel.Velocity.Y); rect.Left = borders.Left; }
private static void CHeckIfHittingABorder(PlayerPlane entity) { if (entity.defeated) return; isHittingABorder = false; drawArea = entity.Get<Rectangle>(); movementSpeed = entity.Get<Velocity2D>(); CheckStopTopBorder(ScreenSpace.Current.Viewport); CheckStopBottomBorder(ScreenSpace.Current.Viewport); entity.Set(drawArea); entity.Set(movementSpeed); }
private static void CheckStopRightBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Right <= borders.Right) return; vel.Velocity = new Vector2D(-0.02f, vel.Velocity.Y); rect.Right = borders.Right; }
private static void CheckStopBottomBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Bottom <= borders.Bottom) return; vel.Velocity = new Vector2D(vel.Velocity.X, -0.02f); rect.Bottom = borders.Bottom; }
private static void CheckStopTopBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Top >= borders.Top) return; vel.Velocity = new Vector2D(vel.Velocity.X, 0.02f); rect.Top = borders.Top; }
private static void CheckStopLeftBorder(Rectangle rect, Velocity2D vel, Rectangle borders) { if (rect.Left >= borders.Left) return; vel.Velocity = new Vector2D(0.02f, vel.Velocity.Y); rect.Left = borders.Left; }