mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 18:19:02 -06:00
DAS priority reversal (#25)
* Reversed the priority of key presses when charging DAS. * Made it an actual config option. * Config should be false by default.
This commit is contained in:
parent
957802a78e
commit
8c1eaec1aa
1
main.lua
1
main.lua
@ -12,6 +12,7 @@ function love.load()
|
|||||||
config["side_next"] = false
|
config["side_next"] = false
|
||||||
config["reverse_rotate"] = true
|
config["reverse_rotate"] = true
|
||||||
config["fullscreen"] = false
|
config["fullscreen"] = false
|
||||||
|
config["das_last_key"] = false
|
||||||
|
|
||||||
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});
|
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});
|
||||||
|
|
||||||
|
@ -223,30 +223,60 @@ function GameMode:onGameOver()
|
|||||||
switchBGM(nil)
|
switchBGM(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameMode:chargeDAS(inputs)
|
-- DAS functions
|
||||||
if inputs[self.das.direction] == true then
|
|
||||||
local das_frames = self.das.frames + 1
|
function GameMode:startRightDAS()
|
||||||
if das_frames >= self:getDasLimit() then
|
self.move = "right"
|
||||||
if self.das.direction == "left" then
|
self.das = { direction = "right", frames = 0 }
|
||||||
self.move = (self:getARR() == 0 and "speed" or "") .. "left"
|
end
|
||||||
self.das.frames = self:getDasLimit() - self:getARR()
|
|
||||||
elseif self.das.direction == "right" then
|
function GameMode:startLeftDAS()
|
||||||
self.move = (self:getARR() == 0 and "speed" or "") .. "right"
|
self.move = "left"
|
||||||
self.das.frames = self:getDasLimit() - self:getARR()
|
self.das = { direction = "left", frames = 0 }
|
||||||
end
|
end
|
||||||
else
|
|
||||||
self.move = "none"
|
function GameMode:continueDAS()
|
||||||
self.das.frames = das_frames
|
local das_frames = self.das.frames + 1
|
||||||
|
if das_frames >= self:getDasLimit() then
|
||||||
|
if self.das.direction == "left" then
|
||||||
|
self.move = (self:getARR() == 0 and "speed" or "") .. "left"
|
||||||
|
self.das.frames = self:getDasLimit() - self:getARR()
|
||||||
|
elseif self.das.direction == "right" then
|
||||||
|
self.move = (self:getARR() == 0 and "speed" or "") .. "right"
|
||||||
|
self.das.frames = self:getDasLimit() - self:getARR()
|
||||||
end
|
end
|
||||||
elseif inputs["right"] == true then
|
|
||||||
self.move = "right"
|
|
||||||
self.das = { direction = "right", frames = 0 }
|
|
||||||
elseif inputs["left"] == true then
|
|
||||||
self.move = "left"
|
|
||||||
self.das = { direction = "left", frames = 0 }
|
|
||||||
else
|
else
|
||||||
self.move = "none"
|
self.move = "none"
|
||||||
self.das = { direction = "none", frames = -1 }
|
self.das.frames = das_frames
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function GameMode:stopDAS()
|
||||||
|
self.move = "none"
|
||||||
|
self.das = { direction = "none", frames = -1 }
|
||||||
|
end
|
||||||
|
|
||||||
|
function GameMode:chargeDAS(inputs)
|
||||||
|
if config["das_last_key"] then
|
||||||
|
if inputs["right"] == true and self.das.direction ~= "right" and not self.prev_inputs["right"] then
|
||||||
|
self:startRightDAS()
|
||||||
|
elseif inputs["left"] == true and self.das.direction ~= "left" and not self.prev_inputs["left"] then
|
||||||
|
self:startLeftDAS()
|
||||||
|
elseif inputs[self.das.direction] == true then
|
||||||
|
self:continueDAS()
|
||||||
|
else
|
||||||
|
self:stopDAS()
|
||||||
|
end
|
||||||
|
else -- default behaviour, das first key pressed
|
||||||
|
if inputs[self.das.direction] == true then
|
||||||
|
self:continueDAS()
|
||||||
|
elseif inputs["right"] == true then
|
||||||
|
self:startRightDAS()
|
||||||
|
elseif inputs["left"] == true then
|
||||||
|
self:startLeftDAS()
|
||||||
|
else
|
||||||
|
self:stopDAS()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user