summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game.fnl27
-rw-r--r--menu.fnl11
-rw-r--r--music/girl_from_mars.xmbin0 -> 67333 bytes
-rw-r--r--music/key_generators.xmbin0 -> 64679 bytes
-rw-r--r--music/miafan2010_-_speed_chip.s3mbin0 -> 7952 bytes
-rw-r--r--music/nesulos.itbin0 -> 47882 bytes
-rw-r--r--music/october_chip.xmbin0 -> 25822 bytes
-rw-r--r--music/the_dim_dungeon.xmbin0 -> 24023 bytes
-rw-r--r--music/the_epic_chip.xmbin0 -> 189254 bytes
-rw-r--r--player.fnl2
-rw-r--r--sound/jump.wavbin0 -> 14328 bytes
-rw-r--r--sound/spit.wavbin0 -> 4068 bytes
12 files changed, 36 insertions, 4 deletions
diff --git a/game.fnl b/game.fnl
index 49ba063..4796532 100644
--- a/game.fnl
+++ b/game.fnl
@@ -20,6 +20,23 @@
(local slimeball (require :slimeball))
(local world (require :world))
+(local music [(love.audio.newSource "music/girl_from_mars.xm" "stream")
+ (love.audio.newSource "music/key_generators.xm" "stream")
+ (love.audio.newSource "music/miafan2010_-_speed_chip.s3m" "stream")
+ (love.audio.newSource "music/october_chip.xm" "stream")
+ (love.audio.newSource "music/the_dim_dungeon.xm" "stream")
+ (love.audio.newSource "music/the_epic_chip.xm" "stream")])
+(var current-music nil)
+
+(fn update-music []
+ (when current-music
+ (: current-music :stop))
+ (let [index (math.random 1 (# music))]
+ (set current-music (. music index))
+ (: current-music :setVolume 0.5)
+ (: current-music :setLooping true)
+ (: current-music :play)))
+
(local map-order ["sandbox" "babysteps"])
(var screen-alpha 1)
@@ -31,9 +48,12 @@
(var current-world nil)
(var current-camera nil)
+(local spit-sfx (love.audio.newSource "sound/spit.wav" "static"))
+
(fn next-map []
(let [map-name (table.remove map-order 1)]
(when (~= nil map-name)
+ (update-music)
(set screen-alpha 1)
(set welcome-message-y (- (: (love.graphics.getFont) :getHeight)))
(set welcome-message-timer 64)
@@ -82,6 +102,7 @@
(fn keypressed [key set-mode]
(when (= key "x")
+ (: spit-sfx :play)
(: current-world :add-slimeball (slimeball.new current-player)))
(let [method (if (= key "right") :move-right
(= key "left") :move-left
@@ -99,7 +120,11 @@
(fn click [])
-{:draw draw
+(fn activate []
+ (update-music))
+
+{:activate activate
+ :draw draw
:update update
:keypressed keypressed
:keyreleased keyreleased
diff --git a/menu.fnl b/menu.fnl
index 23e0166..e696161 100644
--- a/menu.fnl
+++ b/menu.fnl
@@ -21,6 +21,11 @@
(local logo (love.graphics.newImage "art/logo.png"))
+(local menu-music (love.audio.newSource "music/nesulos.it" "stream"))
+(: menu-music :setVolume 0.5)
+(: menu-music :setLooping true)
+(: menu-music :play)
+
(fn button-width [button]
(: (love.graphics.getFont) :getWidth (. button :text)))
@@ -48,10 +53,11 @@
(love.graphics.print text x y)))
(fn play-clicked [set-mode]
+ (: menu-music :stop)
(set-mode :game))
(fn sound-clicked []
- (print "No sound"))
+ (love.audio.setVolume (if (= (love.audio.getVolume) 0) 1 0)))
(fn quit-clicked []
(love.event.quit))
@@ -109,8 +115,7 @@
(>= mouse-y y) (<= mouse-y (+ y height)))
((. button :function) set-mode)))))
-{:activate activate
- :draw draw
+{:draw draw
:update update
:keypressed keypressed
:keyreleased keyreleased
diff --git a/music/girl_from_mars.xm b/music/girl_from_mars.xm
new file mode 100644
index 0000000..f33aaa5
--- /dev/null
+++ b/music/girl_from_mars.xm
Binary files differ
diff --git a/music/key_generators.xm b/music/key_generators.xm
new file mode 100644
index 0000000..42c8d9b
--- /dev/null
+++ b/music/key_generators.xm
Binary files differ
diff --git a/music/miafan2010_-_speed_chip.s3m b/music/miafan2010_-_speed_chip.s3m
new file mode 100644
index 0000000..7974095
--- /dev/null
+++ b/music/miafan2010_-_speed_chip.s3m
Binary files differ
diff --git a/music/nesulos.it b/music/nesulos.it
new file mode 100644
index 0000000..ec40764
--- /dev/null
+++ b/music/nesulos.it
Binary files differ
diff --git a/music/october_chip.xm b/music/october_chip.xm
new file mode 100644
index 0000000..85fa285
--- /dev/null
+++ b/music/october_chip.xm
Binary files differ
diff --git a/music/the_dim_dungeon.xm b/music/the_dim_dungeon.xm
new file mode 100644
index 0000000..2e509df
--- /dev/null
+++ b/music/the_dim_dungeon.xm
Binary files differ
diff --git a/music/the_epic_chip.xm b/music/the_epic_chip.xm
new file mode 100644
index 0000000..5b09fbc
--- /dev/null
+++ b/music/the_epic_chip.xm
Binary files differ
diff --git a/player.fnl b/player.fnl
index 9b8509a..d9e8475 100644
--- a/player.fnl
+++ b/player.fnl
@@ -20,6 +20,7 @@
(local draw (require :draw))
(local gravity 128)
+(local jump-sfx (love.audio.newSource "sound/jump.wav" "static"))
;; Returns a pair, (x, y) that represents the player's next position, assuming
;; that it did /not/ collide with anything. The role of collision detection, and
@@ -69,6 +70,7 @@
(fn jump [player]
(tset player :action :jump true)
(when (> 10 (math.abs (. player :y-vel)))
+ (: jump-sfx :play)
(tset player :y-vel (- (. player :goal-y-vel)))))
(fn bounce [player x-normal y-normal]
diff --git a/sound/jump.wav b/sound/jump.wav
new file mode 100644
index 0000000..ef84111
--- /dev/null
+++ b/sound/jump.wav
Binary files differ
diff --git a/sound/spit.wav b/sound/spit.wav
new file mode 100644
index 0000000..2e9c1f4
--- /dev/null
+++ b/sound/spit.wav
Binary files differ