From 699efeb2fb0faa6a8926e3bc10381177b29ef5c4 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 29 Apr 2019 10:42:43 +0200 Subject: [PATCH] modules/world: add a view number limit --- gamecore/modules/world/camera.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gamecore/modules/world/camera.lua b/gamecore/modules/world/camera.lua index 3df293b..bcdcbe3 100644 --- a/gamecore/modules/world/camera.lua +++ b/gamecore/modules/world/camera.lua @@ -27,7 +27,8 @@ local cwd = (...):gsub('%.camera$', '') .. "." local CameraSystem = Object:extend() local View = require(cwd .. "libs.hump.camera") -local SPLITSCREEN_ISVERTICAL = false +local SPLITSCREEN_ISVERTICAL = false +local SCREEN_LIMIT = 4 -- INIT FUNCTIONS -- Initialize the camera system @@ -63,13 +64,15 @@ end -- Access data from the views function CameraSystem:addView(x, y) - local view = {} + if (#self.view.list < SCREEN_LIMIT) then + local view = {} - view.cam = View(x, y, 1, 0, true) - -- TODO: add a target system in order to make a camera able - -- to target a specific object + view.cam = View(x, y, 1, 0, true) + -- TODO: add a target system in order to make a camera able + -- to target a specific object - table.insert(self.views.list, view) + table.insert(self.views.list, view) + end end function CameraSystem:getView(id)