I had a heck of a time trying to figure out the orthographic camera. Which script goes where, which script I need to update, etc…
- get the Orthographic camera add as a dependency and fetch libraries.
- now add a game object collection to your main collection. And choose /orthographic/camera.go
- click on /script - /orthographic/camera.script
- configure accordingly. (change default to either FIXED_AUTO or FIXED_ZOOM). Documentation is clear what the difference is, so use that to figure out which is best.
- Go a GUI_SCRIPT that is on that screen (like my score GUI)
- add this to the top of the GUI_SCRIPT file
local camera = require "orthographic.camera"
local camera_id = hash("/camera")
- Now add this to the GUI_SCRIPT
function on_message(self, message_id, message, sender)
if message_id == hash("layout_changed") and message.id == hash("Landscape") then
-- switching layout to landscape
camera.set_zoom(camera_id, 1.0) --reset zoom for landscape mode
msg.post("main:/veggie_order_portrait", "disable") --disable the portrait mode veggie_order graphic
msg.post("main:/veggie_order_landscape", "enable") --disable the landscape mode veggie_order graphic
elseif message_id == hash("layout_changed") and message.id == hash("Portrait") then
-- switching layout to portrait
camera.set_zoom(camera_id, 2.0) --increase the zoom the the shopping bag fills up more the screen
msg.post("main:/veggie_order_portrait", "enable") --disable the portrait mode veggie_order graphic
msg.post("main:/veggie_order_landscape", "disable") --disable the landscape mode veggie_order graphic
end
end
I hope I didn’t leave out a key step, but I’m hoping this helps someone apply the camera more easily and a lot quicker in the future.