[FIX] Dispar on key pressed
This commit is contained in:
+14
-2
@@ -47,6 +47,7 @@ end
|
|||||||
|
|
||||||
function controller:check(action)
|
function controller:check(action)
|
||||||
local result = false
|
local result = false
|
||||||
|
|
||||||
if action=="up" then
|
if action=="up" then
|
||||||
result = key.down(keyUp) or pad.down(btnUp)
|
result = key.down(keyUp) or pad.down(btnUp)
|
||||||
elseif action=="down" then
|
elseif action=="down" then
|
||||||
@@ -58,11 +59,22 @@ function controller:check(action)
|
|||||||
elseif action=="jump" then
|
elseif action=="jump" then
|
||||||
result = key.down(keyJump) or pad.down(btnJump)
|
result = key.down(keyJump) or pad.down(btnJump)
|
||||||
elseif action=="shoot" then
|
elseif action=="shoot" then
|
||||||
-- result = key.down(keyShoot) or pad.down(btnShoot)
|
result = key.down(keyShoot) or pad.down(btnShoot)
|
||||||
result = self:key_release(keyShoot) or self:key_release(btnShoot)
|
if result then
|
||||||
|
if self.keysdown[keyShoot] then
|
||||||
|
result = false
|
||||||
|
else
|
||||||
|
result = true
|
||||||
|
end
|
||||||
|
self.keysdown[keyShoot] = true
|
||||||
|
else
|
||||||
|
self.keysdown[keyShoot] = false
|
||||||
|
end
|
||||||
elseif action=="ESC" then
|
elseif action=="ESC" then
|
||||||
result = key.press(key.ESCAPE) or pad.press(btnPause)
|
result = key.press(key.ESCAPE) or pad.press(btnPause)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user