-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
79 lines (66 loc) · 1.55 KB
/
main.lua
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require 'src/utils'
function love.load()
initSprites()
setupWindow()
initSounds()
initEnemies()
state = 'world'
pkmn = false
cubone = sprites[1]
SPEED = 120
x = VIRTUAL_WIDTH
y = VIRTUAL_HEIGHT / 2
anime = Animation {
frames = {cubone},
interval = 0.2
}
sounds['music']:setLooping(true)
sounds['music']:play()
end
function love.draw()
if state == 'world' then
drawBackground()
love.graphics.draw(anime:getCurrentFrame(), x, y, 0, 2.6, 2.6)
end
displayFPS()
if state == 'battle' then
drawBattleField()
drawCubone()
drawEnemy()
end
end
function love.update(dt)
if state == 'world' then
if love.keyboard.isDown('w', 'up') then
walkUp(dt)
elseif love.keyboard.isDown('a', 'left') then
walkLeft(dt)
elseif love.keyboard.isDown('d', 'right') then
walkRight(dt)
elseif love.keyboard.isDown('s', 'down') then
walkDown(dt)
end
end
if state == 'battle' and play_growl == true then
wait = wait - 5
if wait == 0 then
enemies[e].growl:setVolume(0.3)
enemies[e].growl:play()
play_growl = false
end
end
if state == 'battle' then
battleModeOn()
if tackle then
time = time - 1
taackle()
end
if bone then
time = time - 1
boone()
end
if run then
ruun()
end
end
end