Made it so you can't hold the keys to pass the song
This commit is contained in:
parent
683406da5c
commit
0d31c90532
31
main.lua
31
main.lua
@ -63,6 +63,19 @@ local directions = {
|
||||
"RIGHT"
|
||||
}
|
||||
|
||||
local pressed = {
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
}
|
||||
local holded = {
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
}
|
||||
|
||||
function love.load()
|
||||
|
||||
characters.bf = myTypes.character("bf")
|
||||
@ -91,6 +104,12 @@ function love.load()
|
||||
end
|
||||
|
||||
local function checkNote(dir)
|
||||
if pressed[dir] or holded[dir] then
|
||||
pressed[dir] = false
|
||||
holded[dir] = true
|
||||
return -- You dont check if you are already holding and not just pressing
|
||||
end
|
||||
pressed[dir] = true
|
||||
for index, note in next, notes do
|
||||
if note.position - conductor.songPosition < 200 then
|
||||
if note.mustPress and not note.pressed and note.direction == dir then
|
||||
@ -133,15 +152,27 @@ function love.update(dt)
|
||||
|
||||
if love.keyboard.isDown("a") then
|
||||
checkNote(1)
|
||||
else
|
||||
holded[1] = false
|
||||
pressed[1] = false
|
||||
end
|
||||
if love.keyboard.isDown("s") then
|
||||
checkNote(2)
|
||||
else
|
||||
holded[2] = false
|
||||
pressed[2] = false
|
||||
end
|
||||
if love.keyboard.isDown("up") then
|
||||
checkNote(3)
|
||||
else
|
||||
holded[3] = false
|
||||
pressed[3] = false
|
||||
end
|
||||
if love.keyboard.isDown("right") then
|
||||
checkNote(4)
|
||||
else
|
||||
holded[4] = false
|
||||
pressed[4] = false
|
||||
end
|
||||
|
||||
for index, note in next, notes do
|
||||
|
Reference in New Issue
Block a user