ca0e8212
Geoffrey PREUD'HOMME
Code original
|
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
|
function scene2_load()
starttimer = 0
shakeamount = 0
rockets[1].x = 50
rockets[1]:start()
launchsound:stop()
launchsound:play()
for y = 1, 30 do
for i = 1, 5 do
table.insert(clouds, cloud:new(true, -y*30))
end
end
backgroundcolor = {love.graphics.getBackgroundColor()}
end
function scene2_update(dt)
for i, v in pairs(clouds) do
v:update(dt)
end
rockets[1]:update(dt)
if starttimer > 7 then
love.graphics.setBackgroundColor(0, 0, 0)
elseif starttimer > 6 then
local r, g, b = unpack(backgroundcolor)
r = r*(1-(starttimer-6)/1)
g = g*(1-(starttimer-6)/1)
b = b*(1-(starttimer-6)/1)
love.graphics.setBackgroundColor(r, g, b)
end
if starttimer > 7 then
if starttimer - dt <= 7 then
for i = 1, 10 do
table.insert(stars, star:new())
end
end
staralpha = math.min(1, (starttimer-7)/9)
end
end
function scene2_draw()
local launchoffset = 0
if starttimer > 3 then
launchoffset = 10^(starttimer-3)+(starttimer-3)*20
end
love.graphics.translate(0, launchoffset)
for i, v in pairs(clouds) do
v:draw()
end
for i = 1, 2 do
draw(groundimg, -math.mod(scrollx, 100) + (i-1)*100, 59)
end
for i, v in pairs(bushes) do
v:draw()
end
love.graphics.translate(0, -launchoffset)
for i,v in pairs(stars) do
v:draw()
end
love.graphics.setColor(255, 255, 255, 255)
rockets[1]:draw()
end
|