mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 19:19:21 +01:00
Started editing input system for smoother motion
Here I have prepared functions on the engine's side necessary for modified input system. I kept old functions in comments for reference.
This commit is contained in:
parent
e02526564a
commit
167450d39a
@ -8,6 +8,10 @@ local GUI = require("GUI")
|
||||
local event = require("Event")
|
||||
local filesystem = require("Filesystem")
|
||||
|
||||
local inputX = 0
|
||||
local inputY = 0
|
||||
local inputYaw = 0
|
||||
|
||||
---------------------------------------------------- Константы ------------------------------------------------------------------
|
||||
|
||||
local rayEngine = {}
|
||||
@ -189,27 +193,46 @@ function rayEngine.rotate(angle)
|
||||
end
|
||||
|
||||
function rayEngine.turnRight()
|
||||
rayEngine.rotate(rayEngine.player.rotationSpeed)
|
||||
inputYaw = 1
|
||||
--rayEngine.rotate(rayEngine.player.rotationSpeed)
|
||||
end
|
||||
|
||||
function rayEngine.turnLeft()
|
||||
rayEngine.rotate(-rayEngine.player.rotationSpeed)
|
||||
inputYaw = -1
|
||||
--rayEngine.rotate(-rayEngine.player.rotationSpeed)
|
||||
end
|
||||
|
||||
function rayEngine.stopY()
|
||||
inputY = 0
|
||||
end
|
||||
|
||||
function rayEngine.stopX()
|
||||
inputX = 0
|
||||
end
|
||||
|
||||
|
||||
function rayEngine.stopYaw()
|
||||
inputYaw = 0
|
||||
end
|
||||
|
||||
function rayEngine.moveForward()
|
||||
rayEngine.move(rayEngine.player.moveSpeed, 0)
|
||||
inputY = 1
|
||||
--rayEngine.move(rayEngine.player.moveSpeed, 0)
|
||||
end
|
||||
|
||||
function rayEngine.moveBackward()
|
||||
rayEngine.move(-rayEngine.player.moveSpeed, 0)
|
||||
inputY = -1
|
||||
--rayEngine.move(-rayEngine.player.moveSpeed, 0)
|
||||
end
|
||||
|
||||
function rayEngine.moveLeft()
|
||||
rayEngine.move(0, -rayEngine.player.moveSpeed)
|
||||
inputX = -1
|
||||
--rayEngine.move(0, -rayEngine.player.moveSpeed)
|
||||
end
|
||||
|
||||
function rayEngine.moveRight()
|
||||
rayEngine.move(0, rayEngine.player.moveSpeed)
|
||||
inputX = 1
|
||||
--rayEngine.move(0, rayEngine.player.moveSpeed)
|
||||
end
|
||||
|
||||
function rayEngine.jump()
|
||||
@ -524,6 +547,9 @@ end
|
||||
function rayEngine.update()
|
||||
local frameRenderClock = os.clock()
|
||||
|
||||
rayEngine.rotate(rayEngine.player.rotationSpeed * inputYaw)
|
||||
rayEngine.move(rayEngine.player.moveSpeed * inputY, rayEngine.player.moveSpeed * inputX)
|
||||
|
||||
rayEngine.drawWorld()
|
||||
if rayEngine.currentWeapon then rayEngine.drawWeapon() end
|
||||
if rayEngine.minimapEnabled then rayEngine.drawMap(3, 2, 24, 24, 0.5) end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user