-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
42 lines (37 loc) · 765 Bytes
/
main.lua
File metadata and controls
42 lines (37 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require "ddr"
function love.load()
arrow.add(10,10,80)
perfect = false
end
function love.update(dt)
arrow:move(dt)
arrow:collision()
print(score)
s = s + .005
gradient()
end
function love.draw()
board()
arrow:draw()
end
math.randomseed(os.time())
function love.keypressed(key)
perfect = false
if key == "escape" then
love.event.quit()
end
for j=1, 4 do
for i,v in ipairs(arrow) do
if v.lane == j and key == keys[j] then
if v.y >= bar.y and v.y + v.h <= bar.y + bar.h then
v.status = 'perfect'
score = score + 10
end
if v.y >= bar.y - 20 and v.y + v.h <= bar.y + bar.h + 20 and v.status == 'miss' then
v.status = 'good'
score = score + 5
end
end
end
end
end