Defold Orthographic - The Orthographic Camera API


@britzl How to use this library when there are a few states (menu and game screens for example) ?
for example, how to implement this lib in this your example of MenuAndGame

I added camera.go to controller.collection

from game.script I call:“controller:/camera#script”, “follow”, { target = self.followMe })

and got the error:

/orthographic/camera.lua:203: Instance (null) not found



I would use multiple cameras and enable/disable them as I switch screens.

This seems to indicate that self.followMe is nil. Perhaps the object you’re supposed to follow has been deleted?

BTW I’ve released a new version (1.4.2) of the library that adds argument asserts on all public facing functions to warn when this happens.


no, when I add the camera to game.collection. there are no errors.
but okay, I can try to use each camera for each screen collections.

EDIT: yes. I like the solution with where each state has own camera. Thanks!


@britzl any idea how to add the follow_point(x,y) function?


go.set_position(vmath.vector3(x,y,0), “camera id”) should be enough. The camera centers the view on its position.