Ukendio / Game

Mozilla Public License 2.0
18 stars 2 forks source link

We need a main menu #26

Closed Ukendio closed 3 years ago

Ukendio commented 3 years ago

Currently it is awkward to join the game without a main menu, I was thinking something along the lines of Boxing league, where the camera orients around the movement of the mouse.

Tob made something that could be implemented

local MAX_MOVE_X = 5
local MAX_MOVE_Y = 5
local defaultCF = CFrame.new(0, 10, 5)

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = defaultCF
camera.CameraSubject = nil

game:GetService("UserInputService").InputChanged:Connect(function(inputObj)
    print(inputObj)
    if inputObj.UserInputType == Enum.UserInputType.MouseMovement then
        local xOffsetFromCenter = (inputObj.Position.X / camera.ViewportSize.X) - 0.5
        local yOffsetFromCenter = -((inputObj.Position.Y / camera.ViewportSize.Y) - 0.5)
        camera.CFrame = defaultCF * CFrame.new(MAX_MOVE_X * xOffsetFromCenter, MAX_MOVE_Y * yOffsetFromCenter, 0)
    end
end)