public override void Move()
        {
            if (SwinGame.MouseX() >= 850 && SwinGame.CameraX() <= 1550)
            {
                SwinGame.MoveCameraTo(SwinGame.CameraX() + 10, SwinGame.CameraY());
            }

            if (SwinGame.MouseX() <= 150 && SwinGame.CameraX() >= 20)
            {
                SwinGame.MoveCameraTo(SwinGame.CameraX() - 10, SwinGame.CameraY());
            }
            if (SwinGame.MouseY() >= 450 && SwinGame.CameraY() <= 830)
            {
                SwinGame.MoveCameraTo(SwinGame.CameraX(), SwinGame.CameraY() + 10);
            }
            if (SwinGame.MouseY() <= 100 && SwinGame.CameraY() >= 20)
            {
                SwinGame.MoveCameraTo(SwinGame.CameraX(), SwinGame.CameraY() - 10);
            }
        }
Example #2
0
        public override void OnRender(EntityManager entityManager)
        {
            SwinGame.DrawBitmap(_flipped ? _flippedBitmap : Bitmap, Position);

            string keyText = $"{_keyCount} / {_totalKeyCount} ({(_keyCount / (float)_totalKeyCount * 100.0f):N0}%) keys collected";

            int textWidth  = SwinGame.TextWidth(FontUtilities.Arial24, keyText);
            int textHeight = SwinGame.TextHeight(FontUtilities.Arial24, keyText);

            SwinGame.FillRectangle(SwinGame.RGBAFloatColor(0.0f, 0.0f, 0.0f, 0.5f), SwinGame.CameraX(), SwinGame.CameraY(), textWidth + 4, textHeight + 4);
            FontUtilities.DrawString(FontUtilities.Arial24, keyText, 2.0f + SwinGame.CameraX(), 2.0f + SwinGame.CameraY(), Color.White);

            SwinGame.SetCameraPos(new Point2D
            {
                X = MathUtilities.Clamp(Position.X + Size.X - SwinGame.ScreenWidth() / 2.0f, 0.0f, _mapWidth - SwinGame.ScreenWidth()),
                Y = MathUtilities.Clamp(Position.Y + Size.Y - SwinGame.ScreenHeight() / 2.0f, 0.0f, _mapHeight - SwinGame.ScreenHeight())
            });
        }
Example #3
0
 public float CameraY()
 {
     return(SwinGame.CameraY());
 }
Example #4
0
 public override void Move()
 {
     LocationX = SwinGame.CameraX();
     LocationY = SwinGame.CameraY() + 500;
 }
 public override void Move()
 {
     LocationX = SwinGame.MouseX() - 50 + SwinGame.CameraX();
     LocationY = SwinGame.MouseY() - 50 + SwinGame.CameraY();
 }