[FIX] Dispar on key pressed
This commit is contained in:
+15
-3
@@ -45,8 +45,9 @@ function controller:define(code, key_code)
|
||||
return true
|
||||
end
|
||||
|
||||
function controller:check(action)
|
||||
function controller:check(action)
|
||||
local result = false
|
||||
|
||||
if action=="up" then
|
||||
result = key.down(keyUp) or pad.down(btnUp)
|
||||
elseif action=="down" then
|
||||
@@ -58,11 +59,22 @@ function controller:check(action)
|
||||
elseif action=="jump" then
|
||||
result = key.down(keyJump) or pad.down(btnJump)
|
||||
elseif action=="shoot" then
|
||||
-- result = key.down(keyShoot) or pad.down(btnShoot)
|
||||
result = self:key_release(keyShoot) or self:key_release(btnShoot)
|
||||
result = key.down(keyShoot) or pad.down(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
|
||||
result = key.press(key.ESCAPE) or pad.press(btnPause)
|
||||
end
|
||||
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user