Skip to content

Commit

Permalink
Merge pull request #36 from Myggski/lobby-max-players
Browse files Browse the repository at this point in the history
fix max-players in lobby
  • Loading branch information
Myggski authored Nov 28, 2022
2 parents 7c4bf75 + 5d15e14 commit 3c8b9bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 6 additions & 3 deletions code/game/systems/bubble_controller_system.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local bubble_controller = require "code.game.entities.bubble_controller"
local player = require "code.game.entities.player"
local helper = require "code.game.systems.bubble_controller_system_helper"
local player_input = require "code.game.player_input"
local system = require "code.engine.ecs.system"


-- Is being called every frame
local bubble_controller_system = system(function(self, dt)
local entities = helper.sort_entities(self:to_list(bubble_controller.get_archetype()))
Expand All @@ -12,8 +12,11 @@ local bubble_controller_system = system(function(self, dt)
local expected_number_of_bubbles = number_available_joysticks + 1 - number_active_controllers

-- Remove all bubbles if max players is reached
if number_active_controllers >= GAME.MAX_PLAYERS then
helper.destroy_all(entities)
if #self:to_list(player.get_archetype()) >= GAME.MAX_PLAYERS then
if #entities > 0 then
helper.destroy_all(entities)
end

return
end

Expand Down
4 changes: 0 additions & 4 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ function love.keypressed(key, scancode, is_repeat)
if key == "escape" then
love.event.quit()
end

if key == "f2" then --set to whatever key you want to use
os.execute("cls")
end
end

function love.keyreleased(key, scancode)
Expand Down

0 comments on commit 3c8b9bc

Please sign in to comment.