From f08e14fd51e2b1f5920ac6816774c5e72cbee5c0 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 14 Apr 2020 17:02:17 -0400 Subject: Day 4 progress. --- assets/images/player-bullets.png | Bin 620 -> 566 bytes assets/images/player-bullets.xcf | Bin 2645 -> 2757 bytes assets/images/player.xcf | Bin 2867 -> 2867 bytes assets/sounds/energy-max.wav | Bin 0 -> 179500 bytes assets/sounds/hit.wav | Bin 0 -> 2688 bytes assets/sounds/max-chain.wav | Bin 0 -> 164004 bytes assets/sounds/player-shoot.wav | Bin 806 -> 7050 bytes assets/sounds/voice.aup | 65 ++++++++++ assets/sounds/voice_data/e00/d00/e0000325.au | Bin 0 -> 205516 bytes assets/sounds/voice_data/e00/d00/e00004a0.au | Bin 0 -> 190020 bytes assets/sounds/voice_data/e00/d00/e0000bd0.au | Bin 0 -> 170156 bytes assets/sounds/voice_data/e00/d00/e0000d0c.au | Bin 0 -> 205516 bytes assets/sounds/voice_data/e00/d00/e0000db0.au | Bin 0 -> 190020 bytes assets/sounds/voice_data/e00/d00/e0000e12.au | Bin 0 -> 170156 bytes lisparuga.scm | 36 +++--- lisparuga/enemy.scm | 12 +- lisparuga/game.scm | 184 +++++++++++++++++---------- lisparuga/node.scm | 5 +- lisparuga/player.scm | 45 +++++-- notes.org | 2 +- 20 files changed, 245 insertions(+), 104 deletions(-) create mode 100644 assets/sounds/energy-max.wav create mode 100644 assets/sounds/hit.wav create mode 100644 assets/sounds/max-chain.wav create mode 100644 assets/sounds/voice.aup create mode 100644 assets/sounds/voice_data/e00/d00/e0000325.au create mode 100644 assets/sounds/voice_data/e00/d00/e00004a0.au create mode 100644 assets/sounds/voice_data/e00/d00/e0000bd0.au create mode 100644 assets/sounds/voice_data/e00/d00/e0000d0c.au create mode 100644 assets/sounds/voice_data/e00/d00/e0000db0.au create mode 100644 assets/sounds/voice_data/e00/d00/e0000e12.au diff --git a/assets/images/player-bullets.png b/assets/images/player-bullets.png index 5aecd50..8f0251c 100644 Binary files a/assets/images/player-bullets.png and b/assets/images/player-bullets.png differ diff --git a/assets/images/player-bullets.xcf b/assets/images/player-bullets.xcf index 1977d7a..a9db8e1 100644 Binary files a/assets/images/player-bullets.xcf and b/assets/images/player-bullets.xcf differ diff --git a/assets/images/player.xcf b/assets/images/player.xcf index 4ce0366..a649ef9 100644 Binary files a/assets/images/player.xcf and b/assets/images/player.xcf differ diff --git a/assets/sounds/energy-max.wav b/assets/sounds/energy-max.wav new file mode 100644 index 0000000..c66ffef Binary files /dev/null and b/assets/sounds/energy-max.wav differ diff --git a/assets/sounds/hit.wav b/assets/sounds/hit.wav new file mode 100644 index 0000000..5b26231 Binary files /dev/null and b/assets/sounds/hit.wav differ diff --git a/assets/sounds/max-chain.wav b/assets/sounds/max-chain.wav new file mode 100644 index 0000000..3b9cfee Binary files /dev/null and b/assets/sounds/max-chain.wav differ diff --git a/assets/sounds/player-shoot.wav b/assets/sounds/player-shoot.wav index ec3bb6b..40e3487 100644 Binary files a/assets/sounds/player-shoot.wav and b/assets/sounds/player-shoot.wav differ diff --git a/assets/sounds/voice.aup b/assets/sounds/voice.aup new file mode 100644 index 0000000..5ac0d35 --- /dev/null +++ b/assets/sounds/voice.aup @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/sounds/voice_data/e00/d00/e0000325.au b/assets/sounds/voice_data/e00/d00/e0000325.au new file mode 100644 index 0000000..3faf78d Binary files /dev/null and b/assets/sounds/voice_data/e00/d00/e0000325.au differ diff --git a/assets/sounds/voice_data/e00/d00/e00004a0.au b/assets/sounds/voice_data/e00/d00/e00004a0.au new file mode 100644 index 0000000..96779a4 Binary files /dev/null and b/assets/sounds/voice_data/e00/d00/e00004a0.au differ diff --git a/assets/sounds/voice_data/e00/d00/e0000bd0.au b/assets/sounds/voice_data/e00/d00/e0000bd0.au new file mode 100644 index 0000000..aa6bb24 Binary files /dev/null and b/assets/sounds/voice_data/e00/d00/e0000bd0.au differ diff --git a/assets/sounds/voice_data/e00/d00/e0000d0c.au b/assets/sounds/voice_data/e00/d00/e0000d0c.au new file mode 100644 index 0000000..6ffc431 Binary files /dev/null and b/assets/sounds/voice_data/e00/d00/e0000d0c.au differ diff --git a/assets/sounds/voice_data/e00/d00/e0000db0.au b/assets/sounds/voice_data/e00/d00/e0000db0.au new file mode 100644 index 0000000..cdbe9e5 Binary files /dev/null and b/assets/sounds/voice_data/e00/d00/e0000db0.au differ diff --git a/assets/sounds/voice_data/e00/d00/e0000e12.au b/assets/sounds/voice_data/e00/d00/e0000e12.au new file mode 100644 index 0000000..c0b723e Binary files /dev/null and b/assets/sounds/voice_data/e00/d00/e0000e12.au differ diff --git a/lisparuga.scm b/lisparuga.scm index dc611cd..e5fb888 100644 --- a/lisparuga.scm +++ b/lisparuga.scm @@ -65,21 +65,22 @@ (make #:name 'background #:rank 0 - #:texture background)) + #:texture background) + (make + #:name 'game + #:rank 1 + #:position (vec2 80.0 0.0)))) + +(define-method (on-enter (lisparuga )) (new-game-transition lisparuga)) -(define (new-game-transition lisparuga) +(define-method (new-game-transition lisparuga) (set! (state lisparuga) 'play) (let ((game-over (& lisparuga game-over))) (and game-over (detach game-over))) - (let ((old-game (& lisparuga game))) - (and old-game (detach old-game))) - (attach-to lisparuga - (make - #:name 'game - #:rank 1 - #:position (vec2 80.0 0.0))) - (set! (state lisparuga) 'play)) + (reset (& lisparuga game)) + (set! (state lisparuga) 'play) + (start-stage (& lisparuga game))) (define-method (game-over-transition (lisparuga )) (set! (state lisparuga) 'game-over) @@ -122,14 +123,13 @@ (define-method (on-key-press (lisparuga ) key scancode modifiers repeat?) (match (state lisparuga) ('play - (unless repeat? - (match key - ('z (start-player-shooting (& lisparuga game))) - ('x (toggle-player-polarity (& lisparuga game))) - ('c (fire-player-homing-missiles (& lisparuga game))) - ('r (spawn-enemies (& lisparuga game))) - ('e (set! (energy (& lisparuga game player)) 120)) - (_ #t)))) + (match key + ('z (start-player-shooting (& lisparuga game))) + ('x (unless repeat? + (toggle-player-polarity (& lisparuga game)))) + ('c (unless repeat? + (fire-player-homing-missiles (& lisparuga game)))) + (_ #t))) ((or 'win 'game-over) (match key ('return (new-game-transition lisparuga)) diff --git a/lisparuga/enemy.scm b/lisparuga/enemy.scm index aa5335e..06533ea 100644 --- a/lisparuga/enemy.scm +++ b/lisparuga/enemy.scm @@ -49,6 +49,7 @@ ;;; (define-asset explosion-sound (load-audio (scope-asset "sounds/explosion.wav"))) +(define-asset hit-sound (load-audio (scope-asset "sounds/hit.wav"))) (define-class () (health #:accessor health #:init-keyword #:health) @@ -56,15 +57,14 @@ (parting-shots #:getter parting-shots #:init-keyword #:parting-shots) (fire-parting-shots? #:accessor fire-parting-shots? #:init-form #f)) -(define-method (on-kill (enemy )) - #t) - (define-method (damage (enemy ) x) (let ((new-health (max (- (health enemy) x) 0))) (set! (health enemy) new-health) - (when (zero? new-health) - (audio-play (asset-ref explosion-sound) - #:volume 0.5)))) + (if (zero? new-health) + (audio-play (asset-ref explosion-sound) + #:volume 0.5) + (audio-play (asset-ref hit-sound) + #:volume 0.5)))) (define-method (dead? (enemy )) (zero? (health enemy))) diff --git a/lisparuga/game.scm b/lisparuga/game.scm index 9e79898..f5b3082 100644 --- a/lisparuga/game.scm +++ b/lisparuga/game.scm @@ -23,6 +23,7 @@ (define-module (lisparuga game) #:use-module (chickadee) + #:use-module (chickadee math) #:use-module (chickadee math rect) #:use-module (chickadee math vector) #:use-module (chickadee render color) @@ -62,7 +63,16 @@ ;; scrolling background (define-class () (player-control? #:accessor player-control? #:init-value #f) - (complete? #:accessor complete? #:init-value #f)) + (complete? #:accessor complete? #:init-value #f) + (skip-tutorial? #:accessor skip-tutorial? #:init-value #f)) + +(define-method (reset (game )) + (set! (player-control? game) #f) + (set! (complete? game) #f) + (reset (& game player)) + (for-each detach (children (& game enemies))) + (let ((battle-report (& game battle-report))) + (and battle-report (detach battle-report)))) (define-method (initialize (game ) initargs) (next-method) @@ -81,6 +91,7 @@ #:rank 2 #:capacity 500 #:texture-atlas player-bullet-atlas)) + (player (make-player player-bullets)) (enemy-bullets (make #:name 'enemy-bullets #:rank 5 @@ -98,11 +109,13 @@ (ui (make #:name 'ui #:rank 999))) + (set! (rank player) 1) (attach-to game (make #:name 'clouds #:rank 0 #:texture clouds) + player player-bullets (make #:name 'enemies @@ -128,26 +141,11 @@ #:align 'right) (make