Skip to content

Commit b319278

Browse files
committed
Finished up
1 parent de406a2 commit b319278

File tree

9 files changed

+46
-19
lines changed

9 files changed

+46
-19
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
1-
# love2d-games
2-
A collection of games written in [Löve](https://love2d.org).
1+
# love2d-demos
2+
A collection of (not necessarily playable) demos written
3+
in [Löve](https://love2d.org).
4+
5+
All of the source code is licensed under the [GPLv3](LICENSE).
6+
The artwork however is subject to miscellaneous licenses, which
7+
are presented in the credits section of each demo (and possibly
8+
within the demo itself.)
9+
10+
In order to play them, you have to have Löve installed. Then simply
11+
download the ``.love``-file and open it with Löve.
12+
13+
## Thunderstorm
14+
![Thunderstorm screenshot](thunderstorm/screenshot.png "Thunderstorm screenshot")
15+
16+
A little scene displaying a thunderstorm in a desolate city.
17+
It's main focus is generating time-delayed sound and graphics.
18+
19+
**Löve-File:** [thunderstorm.love](love/thunderstorm.love)
20+
21+
**Credits:** [Credits](thunderstorm/credits.md)

bin/thunderstorm.love

268 KB
Binary file not shown.

thunderstorm/credits.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Credits for *Thunderstorm*
2+
3+
Rain sound
4+
* Author: thebardofblasphemy
5+
* URL: https://opengameart.org/content/moderate-rain-tin-roof-loop
6+
* License: GPLv2
7+
8+
Thunder sound
9+
* "Thunder, Very Close, Rain, 01.wav" by InspectorJ (www.jshaw.co.uk)
10+
* Author: InspectorJ
11+
* URL: https://opengameart.org/content/thunder-very-close-rain-01
12+
* License: CC-BY 3.0
13+
14+
City and sky background
15+
* Author: TokyoGeisha
16+
* URL: https://opengameart.org/content/ruined-city-background
17+
* License: CC0 (Public domain)

thunderstorm/lib/thunderstorm.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ Thunderstorm.prototype.update = function(self, dt)
4848
end
4949

5050
bolt.sound_delay = bolt.sound_delay - dt
51-
if bolt.sound_delay <= 0 then
51+
if bolt.sound_delay <= 0 and not bolt.sound_played then
5252
love.audio.play(bolt.sound)
53+
bolt.sound_played = true
5354
end
5455

5556
-- Keep bolts, which pulses haven't all been
5657
-- dispayed yet or which sound hasn't been played.
57-
if bolt.sound_delay <= 0 or bolt.pulses[bolt.pulse_idx] ~= nil then
58+
if bolt.sound_delay > 0 or bolt.pulses[bolt.pulse_idx] ~= nil then
5859
table.insert(newbolts, bolt)
5960
end
6061
end
@@ -68,7 +69,7 @@ Thunderstorm.prototype.update = function(self, dt)
6869
local index = love.math.random(1, #self.layers)
6970
local bolt = self:newBolt(self.layers[index])
7071
table.insert(self.layers[index].bolts, bolt)
71-
self.next_bolt_in = randfloat(1.0, 10.0)
72+
self.next_bolt_in = randfloat(5.0, 10.0)
7273
end
7374

7475
end
@@ -90,6 +91,7 @@ Thunderstorm.prototype.newBolt = function(self, layer)
9091
bolt.pulse_idx = 1
9192
bolt.sound = self.sounds[love.math.random(1, #self.sounds)]
9293
bolt.sound_delay = randfloat(layer.min_sound_delay, layer.max_sound_delay)
94+
bolt.sound_played = false
9395

9496
return bolt
9597
end

thunderstorm/main.lua

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ function love.load()
4242

4343
-- particles and bolts
4444
thunderstorm = Thunderstorm.new(thundersounds, false)
45-
-- TODO: Add correct width and height for each layer.
46-
thunderstorm:addLayer()
47-
thunderstorm:addLayer()
48-
thunderstorm:addLayer()
45+
thunderstorm:addLayer({width=1920, height=480, min_sound_delay=5.0, max_sound_delay=5.5})
46+
thunderstorm:addLayer({width=1920, height=710, min_sound_delay=3.0, max_sound_delay=3.5})
47+
thunderstorm:addLayer({width=1920, height=1080, min_sound_delay=0, max_sound_delay=0})
4948
rain = RainGFX.new()
5049
end
5150

@@ -95,12 +94,6 @@ function love.update(dt)
9594
end
9695
end
9796

98-
function love.keypressed(key, scancode, isrepeat)
99-
if key == "escape" then
100-
love.event.quit()
101-
end
102-
end
103-
10497
function love.mousepressed(x, y, button, isTouch)
10598
if exitsprite.x <= x and
10699
x <= exitsprite.x + exitsprite.width and

thunderstorm/res/lightning3.png

-147 KB
Binary file not shown.

thunderstorm/res/thunder1.ogg

-145 KB
Binary file not shown.

thunderstorm/res/urls.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

thunderstorm/screenshot.png

110 KB
Loading

0 commit comments

Comments
 (0)