Joystick can be used in both X and Y

This commit is contained in:
Erkki Seppälä 2014-10-22 21:44:42 +03:00
parent 4eb0612c25
commit 3d2ddcbd62
2 changed files with 2 additions and 3 deletions

View file

@ -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

View file

@ -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