File: howto.lua

package info (click to toggle)
mrrescue 1.02e-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 13,228 kB
  • sloc: makefile: 9; sh: 1
file content (69 lines) | stat: -rw-r--r-- 1,604 bytes parent folder | download | duplicates (2)
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
howto = {}

local lg = love.graphics

function howto.enter()
	state = STATE_HOWTO
	howto.slide = 0
	howto.quad = lg.newQuad(0,0,256,200,getSize(img.howto))
	playMusic("menujazz")
end

function howto.update(dt)
	updateKeys()
end

function howto.draw()
	lg.push()
	lg.scale(config.scale)

	lg.draw(img.howto, howto.quad, 0,0)

	lg.pop()
end

function howto.keypressed(k, uni)
	if k == "right" or k == "down" then
		howto.slide = cap(howto.slide + 1, 0, 8)
		howto.quad:setViewport(0,howto.slide*200,256,200)
		playSound("blip")
	elseif k == "return" then
		if howto.slide < 8 then
			howto.slide = cap(howto.slide + 1, 0, 8)
			howto.quad:setViewport(0,howto.slide*200,256,200)
			playSound("blip")
		else
			playSound("confirm")
			playMusic("opening")
			mainmenu.enter()
		end
	elseif k == "left" or k == "up" then
		howto.slide = cap(howto.slide - 1, 0, 8)
		howto.quad:setViewport(0,howto.slide*200,256,200)
		playSound("blip")
	elseif k == "escape" then
		playSound("confirm")
		playMusic("opening")
		mainmenu.enter()
	end
end

function howto.action(k)
	if k == "right" or k == "down" then
		howto.slide = cap(howto.slide + 1, 0, 8)
		howto.quad:setViewport(0,howto.slide*200,256,200)
		playSound("blip")
	elseif k == "left" or k == "up" then
		howto.slide = cap(howto.slide - 1, 0, 8)
		howto.quad:setViewport(0,howto.slide*200,256,200)
		playSound("blip")
	elseif k == "jump" then
		howto.slide = cap(howto.slide + 1, 0, 8)
		howto.quad:setViewport(0,howto.slide*200,256,200)
		playSound("blip")
	elseif k == "action" then
		playSound("confirm")
		playMusic("opening")
		mainmenu.enter()
	end
end