Dynamic Camera System
The bittyBIG Dynamic Camera System gives Stencyl projects a more flexible camera and output pipeline. It supports zoom, tweening, split-screen, picture-in-picture, viewport transforms, camera rotation, screenshake, and pixel-perfect display behavior.
Quick Start
This is the shortest useful setup: initialize the system, create a camera, and center it on the player.
Common Setups
Full-screen pixel-perfect camera
Use this when one camera fills the full 1920x1080 canvas. A 320x180 camera gives a clean 6x view.
scripts.BittyCameraSystem.init(); scripts.BittyCameraBlocks.createCamera(0); scripts.BittyCameraBlocks.setCameraSize(320, 180, 0); scripts.BittyCameraBlocks.setCameraCenterToActor(player, 0);
Two-player left/right split screen
For a 1920x1080 canvas, each half is 960x1080. A 160x180 camera gives each viewport a clean 6x scale.
scripts.BittyCameraSystem.init(); scripts.BittyCameraBlocks.createCamera(0); scripts.BittyCameraBlocks.createCamera(1); scripts.BittyCameraBlocks.setDisplayPortRect(0, 0, 0, 960, 1080); scripts.BittyCameraBlocks.setDisplayPortRect(1, 960, 0, 960, 1080); scripts.BittyCameraBlocks.setCameraSize(160, 180, 0); scripts.BittyCameraBlocks.setCameraSize(160, 180, 1);
Picture-in-picture camera
Use one main camera and one smaller overlay camera. This example uses a full 1920x1080 main viewport with a 440x248 overlay.
scripts.BittyCameraSystem.init(); scripts.BittyCameraBlocks.createCamera(0); scripts.BittyCameraBlocks.createCamera(1); scripts.BittyCameraBlocks.setDisplayPortRect(0, 0, 0, 1920, 1080); scripts.BittyCameraBlocks.setDisplayPortRect(1, 1440, 40, 440, 248); scripts.BittyCameraBlocks.setCameraSize(320, 180, 0); scripts.BittyCameraBlocks.setCameraSize(110, 62, 1);
Smaller Display Area
For a smaller centered-style setup, use a 1440x810 Display Area. Left/right halves are 720x810.
scripts.BittyCameraSystem.init(); scripts.BittyCameraBlocks.setGameAreaRect(0, 0, 1440, 810); scripts.BittyCameraBlocks.createCamera(0); scripts.BittyCameraBlocks.createCamera(1); scripts.BittyCameraBlocks.setDisplayPortRect(0, 0, 0, 720, 810); scripts.BittyCameraBlocks.setDisplayPortRect(1, 720, 0, 720, 810); scripts.BittyCameraBlocks.setCameraSize(120, 135, 0); scripts.BittyCameraBlocks.setCameraSize(120, 135, 1);
Interactive Viewport Setup Builder
Preview what the final layout will look like, then generate setup code for your project. Viewports split the game canvas, not the full screen.
Block Glossary
This glossary is organized more like Stencyl’s block guide: blocks first, descriptions second, code shown directly under each block.
Key Terms
Display Area - The final rectangle where the whole bittyBIG output appears on the screen.
Viewport - A rectangle inside the Display Area. It controls where a camera image appears.
Camera Size - How much world the camera sees before zoom. This is your low-resolution world view size.
Zoom - Changes how much of the world the camera sees. Higher zoom means a closer view.
Viewport Coordinates - Based on the current Display Area size.
Cameras
Setup
Initialize System
scripts.BittyCameraSystem.init();
Create Camera
scripts.BittyCameraBlocks.createCamera(~);
Render Camera to Viewport
scripts.BittyCameraBlocks.renderCameraToDisplayPort(~,~);
Set Camera Size
scripts.BittyViewports.setViewportSize(~, ~, ~);
Set Camera Scene Lock
scripts.BittyCameraBlocks.setCameraSceneLock(~,~);
Remove Camera
scripts.BittyCameraBlocks.removeCamera(~);
Presets
Apply Camera Preset
scripts.BittyCameraBlocks.applyCameraPreset(~,~);
Apply Camera Preset by Name
scripts.BittyCameraBlocks.applyCameraPreset(~,~);
Position
Set Camera Center
scripts.BittyViewports.setCameraCenter(~, ~, ~);
Set Camera Offsets
scripts.BittyCameraBlocks.setCameraOffsets(~,~,~);
Center Camera to Actor
scripts.BittyCameraBlocks.setCameraCenterToActor(~,~);
Movement
Set Camera Target Center
scripts.BittyCameraBlocks.setCameraTargetCenter(~,~,~);
Set Camera Target to Actor
scripts.BittyCameraBlocks.setCameraTargetCenterToActor(~,~);
Set Follow Style
scripts.BittyCameraBlocks.setCameraFollowStyle(~,~);
Set Follow Speeds
scripts.BittyCameraBlocks.setCameraFollowSpeeds(~,~,~);
Set Lerp Speed
scripts.BittyCameraBlocks.setCameraLerpSpeed(~,~);
Set Zero Radius
scripts.BittyCameraBlocks.setCameraZeroRadius(~,~);
Rotation
Set Camera Rotation
scripts.BittyCameraBlocks.setCameraRotation(~,~);
Get Camera Rotation
scripts.BittyCameraBlocks.getCameraRotation(~)
Reset Camera Rotation
scripts.BittyCameraBlocks.resetCameraRotation(~);
Properties
Camera Exists?
scripts.BittyViewports.cameraExists(~)
Camera Is Transitioning?
scripts.BittyCameraBlocks.isCameraTransitioning(~)
Get Camera X
scripts.BittyViewports.getCameraX(~)
Get Camera Y
scripts.BittyViewports.getCameraY(~)
Get Camera Center X
scripts.BittyViewports.getCameraCenterX(~)
Get Camera Center Y
scripts.BittyViewports.getCameraCenterY(~)
Get Camera Width
scripts.BittyViewports.getViewportWidth(~)
Get Camera Height
scripts.BittyViewports.getViewportHeight(~)
Viewports
Setup
Create Viewport
scripts.BittyCameraBlocks.createDisplayPort(~,~,~,~,~);
Set Viewport Rect
scripts.BittyCameraBlocks.setDisplayPortRect(~,~,~,~,~);
Set Viewport Position
scripts.BittyCameraBlocks.setDisplayPortPosition(~,~,~);
Set Viewport Size
scripts.BittyCameraBlocks.setDisplayPortSize(~,~,~);
Remove Viewport
scripts.BittyCameraBlocks.removeDisplayPort(~);
Appearance
Viewport Background Color
scripts.BittyCameraBlocks.setDisplayPortBackgroundColor(~,~,~);
Clear Viewport Background
scripts.BittyCameraBlocks.clearDisplayPortBackground(~);
Enable Viewport Background
scripts.BittyCameraBlocks.setDisplayPortBackgroundEnabled(~,~);
Viewport Border
scripts.BittyCameraBlocks.setDisplayPortBorder(~,~,~,~);
Viewport Scale Mode
scripts.BittyCameraBlocks.setDisplayPortScaleMode(~,~);
Viewport Transforms
Viewport Rotation
scripts.BittyCameraBlocks.setDisplayPortRotation(~,~);
Flip Viewport Horizontally
scripts.BittyCameraBlocks.setDisplayPortFlipHorizontal(~,~);
Flip Viewport Vertically
scripts.BittyCameraBlocks.setDisplayPortFlipVertical(~,~);
Reset Viewport Transform
scripts.BittyCameraBlocks.resetDisplayPortTransform(~);
Properties
Viewport Exists?
scripts.BittyCameraBlocks.displayPortExists(~)
Get Viewport X
scripts.BittyCameraBlocks.getDisplayPortX(~)
Get Viewport Y
scripts.BittyCameraBlocks.getDisplayPortY(~)
Get Viewport Width
scripts.BittyCameraBlocks.getDisplayPortWidth(~)
Get Viewport Height
scripts.BittyCameraBlocks.getDisplayPortHeight(~)
Display
Setup
Set Display Area
scripts.BittyCameraBlocks.setGameAreaRect(~,~,~,~);
Set Display Area Position
scripts.BittyCameraBlocks.setGameAreaPosition(~,~);
Set Display Area Size
scripts.BittyCameraBlocks.setGameAreaSize(~,~);
Background
Set Background Color
scripts.BittyCameraBlocks.setBackgroundColorInt(~,~);
Set Background Image
scripts.BittyCameraBlocks.setBackgroundImage(~);
Clear Background Image
scripts.BittyCameraBlocks.clearBackgroundImage();
Has Background Image?
scripts.BittyCameraBlocks.hasBackgroundImage()
Properties
Get Display Area X
scripts.BittyCameraBlocks.getGameAreaX()
Get Display Area Y
scripts.BittyCameraBlocks.getGameAreaY()
Get Display Area Width
scripts.BittyCameraBlocks.getGameAreaWidth()
Get Display Area Height
scripts.BittyCameraBlocks.getGameAreaHeight()
Effects
Zoom
Set Camera Base Size
scripts.BittyCameraBlocks.setCameraBaseSize(~,~,~);
Set Zoom
scripts.BittyCameraBlocks.setCameraZoom(~,~);
Tween Zoom
scripts.BittyCameraBlocks.setCameraZoomAdvanced(~,~,~,~);
Get Camera Zoom
scripts.BittyCameraBlocks.getCameraZoom(~)
Reset Camera Zoom
scripts.BittyCameraBlocks.resetCameraZoom(~);
Screenshake
Shake Camera
scripts.BittyCameraBlocks.shakeCamera(~,~,~);
Shake Camera XY
scripts.BittyCameraBlocks.shakeCameraXY(~,~,~,~);
Stop Camera Shake
scripts.BittyCameraBlocks.stopCameraShake(~);
Troubleshooting / FAQ
These are the common first-time problems and quick fixes. Start here when something looks wrong before digging into the deep technical cave. The cave has bats. Probably Haxe bats.
Problem: Nothing appears, or the camera system acts like it does not exist.
Solution: Begin every scene with this block before using any camera, viewport, display, zoom, rotation, or screenshake blocks.
Problem: A camera was created, but it is not showing in the right place.
Solution: Make sure the camera is rendered to a viewport. Use this block after creating the camera and viewport.
Problem: The viewport is too large, too small, or off-screen.
Solution: Use Display Area units. If the Display Area is 960x540, a left-half viewport is 0, 0, 480, 540. Use the Viewport Tester for help.
Problem: The camera shows too much or too little of the world.
Solution: Change Camera Size, not Viewport Size. Camera Size controls how much world the camera sees before zoom.
Problem: Split-screen math feels wrong.
Solution: Split the Display Area, not the screen. For a 720x405 Display Area, left/right split uses 360x405 for each viewport.
Problem: Pixel art looks uneven or blurry.
Solution: Use camera sizes that scale evenly into the viewport. Example: 320x180 into 1920x1080 gives a clean 6x scale.
Problem: Zoom looks broken or crops more than expected.
Solution: Remember that zoom changes how much world the camera sees. Higher zoom means closer view. Set the camera base size first, then apply zoom.
Problem: The camera follows the wrong actor or crashes when centering.
Solution: Make sure the actor variable exists before using it in the block. In the Quick Start example, player means your own actor variable.
Problem: A viewport background or border does not appear.
Solution: Check that the viewport exists first and that alpha is above 0. For a fully visible color, use 100 percent alpha.
Problem: The display area is smaller than the screen and there is empty space around it.
Solution: That can be correct. The Display Area is where the camera output appears. Use background color or background image blocks to control what appears behind it.
Release Notes v 1.0
This release focuses on camera, viewport, display, zoom, rotation, screenshake, multi-viewport support, and pixel-perfect behavior.
Planned Development:
- Add cached tile/world rendering so bittyBIG can rely less on Stencyl’s live redraw path.
- Show debug drawing per viewport.