local world = {
  require("src.world.race")(),
  require("src.world.train")()
};

local world_i = 1

function love.load()
  world[world_i]:load()
end

function love.update(dt)
  world[world_i]:update(dt)
end

function love.draw()
  world[world_i]:draw()
end

function love.keyreleased(key, scancode)
  if (key == "right") then
    world_i = world_i + 1
    if (world_i > 2) then
      world_i = 1
    end
    world[world_i]:reload()
  end
  world[world_i]:keyreleased(key, scancode)
end

function love.keypressed(key, scancode, isrepeat)
  world[world_i]:keypressed(key, scancode, isrepeat)
end

function love.mousereleased(x, y, button, istouch, presses)
  world[world_i]:mousereleased(x, y, button, istouch, presses)
end
