-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathintroscene.lua
More file actions
89 lines (69 loc) · 2.07 KB
/
introscene.lua
File metadata and controls
89 lines (69 loc) · 2.07 KB
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
80
81
82
83
84
85
86
87
88
89
local Timer = require 'libs/knife/knife/timer'
IntroScene = Scene:extend()
local PrologueScene = require "prologuescene"
local DEFAULT_INTERVAL = 3
function IntroScene:new()
end
function IntroScene:init()
soundManager:stopAll()
self.currentSlide = 0
self.slides = {}
table.insert(self.slides, {})
largato_logo = love.graphics.newImage('assets/images/largato_logo_white.png')
table.insert(self.slides, largato_logo)
love_logo = love.graphics.newImage('assets/images/love_logo.png')
table.insert(self.slides, love_logo)
self:nextSlide()
end
function IntroScene:reset()
Timer.clear()
soundManager:stopAll()
self.currentSlide = 0
self:nextSlide()
end
function IntroScene:update(dt)
Timer.update(dt)
end
function IntroScene:draw()
if self.currentSlide > 0 then
local logo = self.slides[self.currentSlide]
if type(logo) == "userdata" then
local x = (CONF_SCREEN_WIDTH / 2) - (logo:getWidth()/2)
local y = (CONF_SCREEN_HEIGHT / 2) - (logo:getHeight()/2)
love.graphics.draw(logo, x, y)
end
end
end
function IntroScene:startTimer()
Timer.after(DEFAULT_INTERVAL, function() self:nextSlide() end)
end
function IntroScene:nextSlide()
if self.currentSlide < #self.slides then
self.currentSlide = self.currentSlide+1
self:startTimer()
else
-- Reloading the timer on prologue scene wasn't working
sceneManager:remove("prologue")
sceneManager:add("prologue", PrologueScene())
sceneManager:setCurrent('prologue')
end
end
function IntroScene:keyPressed(key, scancode, isRepeat)
end
function IntroScene:keyReleased(key, scancode, isRepeat)
end
function IntroScene:mousepressed(x, y, button, istouch, presses)
end
function IntroScene:mousereleased(x, y, button, istouch, presses)
end
function IntroScene:mousemoved(x, y, dx, dy, istouch)
end
function IntroScene:wheelmoved(dx, dy)
end
function IntroScene:gamepadpressed(joystick, button)
end
function IntroScene:gamepadreleased(joystick, button)
end
function IntroScene:gamepadaxis(joystick, axis, value)
end
return IntroScene