Have you ever been frustrated when converting screen to world coordinates in a game with a camera? Have you ever wished it was simple to get a camera to smoothly follow a game object while also having a defined dead zone?
The Orthographic Camera API is designed to simplify these and other camera related functions. Using it in your 2D game is super simple:
- Add the
camera.goto your game
- Make sure your render script handles the
- Interact with the camera either via the
cameramodule or via messages to the
The API :
local camera = require "orthographic.camera" local world = camera.screen_to_world(camera_id, screen) camera.shake(camera_id, [intensity], [duration], [direction], [cb]) camera.follow(camera_id, target, [lerp]) camera.unfollow(camera_id) camera.deadzone(camera_id, left, top, right, bottom)
The camera API is inspired by the Phaser camera component.
- Add functionality to do culling of game objects outside camera view
- Add functionality to specify camera bounds