Skip to content

Commit

Permalink
audio impl
Browse files Browse the repository at this point in the history
  • Loading branch information
srcnalt committed Oct 19, 2019
1 parent 52741e4 commit fbee095
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/levels.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,20 @@
(defmethod trigger-door ((object game-object))
(when (= *transition-state* 0)
(setf *level-switch* t)
(gamekit:play-sound :snd-door)
(incf *transition-state*))
nil)

(defmethod thorn-hit ((object game-object))
(setf *locked* t)
(when (= *transition-state* 0)
(gamekit:play-sound :snd-die)
(incf *transition-state*))
nil)

(defmethod collect-flower ((object game-object))
(push object *collected-flowers*)
(gamekit:play-sound :snd-pick)
(setf (nth (- *game-state* 2) *levels*) (remove object (nth (- *game-state* 2) *levels*)))
nil)

Expand Down Expand Up @@ -203,7 +206,7 @@
(2 0 0 0 4 0 0 0 0 6 0 4 0 0 0 0)
(1 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4)
(1 1 0 0 3 0 4 0 0 4 3 0 0 0 1 1)
(0 0 0 0 3 0 4 0 0 4 3 0 0 0 1 1)
(0 0 0 1 0 1 1 3 1 1 0 1 1 1 0 0)
(0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0)
(0 1 0 0 4 0 0 0 0 0 0 4 0 0 4 5))))
Expand Down
5 changes: 4 additions & 1 deletion src/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@

(defun jump()
(setf *velocity* 0.7)
(setf *grounded* nil))
(setf *grounded* nil)
(gamekit:play-sound :snd-jump))

(defun update-game()
(when (and (< *velocity* 0) (check-collision-all *player*))
Expand Down Expand Up @@ -196,6 +197,8 @@
(setf *game-completed* nil))

(defmethod gamekit:post-initialize ((this moppu))
(gamekit:play-sound :snd-menu :looped-p t)

(gamekit:bind-button
:left :pressed
(lambda () (setf *move-dir* -1)))
Expand Down
1 change: 1 addition & 0 deletions src/menu.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
(if (> *flower-x* -25)
(decf *flower-x* 0.3)
(when (= *transition-state* 0)
(gamekit:stop-sound :snd-menu)
(setf *transition-state* 1))))
(when (= *transition-state* 2)
(setf *flower-x* -2)
Expand Down
8 changes: 8 additions & 0 deletions src/resources.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@
(gamekit:define-image :start-prs "menu/start-pressed.png" :use-nearest-interpolation t)
(gamekit:define-image :credits-msg "messages/credits.png" :use-nearest-interpolation t)
(gamekit:define-image :controls-msg "messages/controls.png" :use-nearest-interpolation t)

; sound
(gamekit:define-sound :snd-button "sound/button.wav")
(gamekit:define-sound :snd-die "sound/die.ogg")
(gamekit:define-sound :snd-door "sound/door.ogg")
(gamekit:define-sound :snd-jump "sound/jump.ogg")
(gamekit:define-sound :snd-menu "sound/menu.ogg")
(gamekit:define-sound :snd-pick "sound/pick.ogg")

0 comments on commit fbee095

Please sign in to comment.