From 3d2ddcbd62457d1442f962395d2c5d720ceecc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= Date: Wed, 22 Oct 2014 21:44:42 +0300 Subject: [PATCH] Joystick can be used in both X and Y --- entities/plane.lua | 3 +-- level_state.lua | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/entities/plane.lua b/entities/plane.lua index 51ae594..68fffd6 100644 --- a/entities/plane.lua +++ b/entities/plane.lua @@ -464,9 +464,8 @@ Plane = Class{ self.turningCcw = isTurning end; - analog = function(self, controlX, controlY, throttleX, throttleY, fire, brake) + analog = function(self, controlY, throttleX, throttleY, fire, brake) if self.health > 0 then - self.controlX = controlX self.controlY = controlY self.throttleX = throttleX self.throttleY = -throttleY diff --git a/level_state.lua b/level_state.lua index a3498ee..dd936fe 100644 --- a/level_state.lua +++ b/level_state.lua @@ -116,7 +116,7 @@ function level_state:update(dt) local x1, y1, x2, y2 = j:getAxes() if #buttons >= 8 and y2 ~= nil then -- button mapping suitable for XBox original controller - players[player]:joystick(x2, y2, x1, y1, buttons[8], buttons[7]) + players[player]:joystick(y2 - x2, x1, y1, buttons[8], buttons[7]) end end end