diff --git a/Applications/RayWalk.app/RayEngine.lua b/Applications/RayWalk.app/RayEngine.lua index 9ba89baa..648a1bb4 100755 --- a/Applications/RayWalk.app/RayEngine.lua +++ b/Applications/RayWalk.app/RayEngine.lua @@ -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