Hey Devs
Hey everyone! I’m working on a new strategy game, and I need some help kind of with the over view camera.
I’m using camera miniplication, for the camera. But I’m trying to make it so player can use WASD to move the camera left and right forward and back.
If you need a example here is one.
Note the game will be a flat baseplate not like this game,
Any help and feedback will be loved. Thank you
3 Likes
Zombiefin
(Zombiefin)
March 27, 2020, 12:50am
#2
Here I quickly crafted up a simple one for you
(Put inside of a LocalScript inside of StarterCharacterScripts)
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
camera.CameraType = "Scriptable"
camera.CFrame = CFrame.new(0,150,0) * CFrame.fromEulerAnglesXYZ(math.rad(-90),0,0)
local currentx = 0
local currenty = 0
game["Run Service"].RenderStepped:Connect(function()
camera.CFrame = camera.CFrame * CFrame.new(currentx, currenty, 0)
end)
mouse.KeyDown:Connect(function(key)
if key == "w" then
currenty = .5
elseif key == "a" then
currentx = -.5
elseif key == "s" then
currenty = -.5
elseif key == "d" then
currentx = .5
end
end)
mouse.KeyUp:Connect(function(key)
if key == "w" then
currenty = 0
elseif key == "a" then
currentx = 0
elseif key == "s" then
currenty = 0
elseif key == "d" then
currentx = 0
end
end)
Good luck with your game idea
6 Likes