fliXNA_xbox.FlxCamera.setBounds C# (CSharp) Method

setBounds() public method

Set the boundaries of the camera. Useful for preventing the camera from scrolling past the edge of a map.
public setBounds ( float X, float Y, float Width, float Height, System.Boolean UpdateWorld = false ) : void
X float
Y float
Width float
Height float
UpdateWorld System.Boolean
return void
        public void setBounds(float X = 0, float Y = 0, float Width = 0, float Height = 0, Boolean UpdateWorld = false)
        {
            if (bounds == null)
                bounds = new FlxRect();
            bounds.make(X, Y, Width, Height);
            if (UpdateWorld)
                FlxG.worldBounds.copyFrom(bounds);
            update();
        }

Usage Example

Example #1
0
 public void follow(FlxCamera Camera = null, int Border = 0, Boolean UpdateWorld = false)
 {
     if (Camera == null)
     {
         Camera = FlxG.camera;
     }
     Camera.setBounds(x + Border * tileSize, y + Border * tileSize, width - Border * tileSize * 2, height - Border * tileSize * 2, UpdateWorld);
 }
All Usage Examples Of fliXNA_xbox.FlxCamera::setBounds