summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2020-04-17 09:22:22 -0400
committerDavid Thompson <dthompson@vistahigherlearning.com>2020-04-17 09:22:22 -0400
commitf7d9a89db443c8449c5f64a1ecf92a9b3abb6fdf (patch)
tree6afc2ad795f67637b44d603adef04e7825ff908d
parent5b461c68e3194aef85bd175d51a30f205adb327f (diff)
Day 7 morning progress.
-rw-r--r--Makefile.am19
-rw-r--r--lisparuga.scm34
-rw-r--r--lisparuga/enemy.scm13
-rw-r--r--lisparuga/game.scm12
4 files changed, 64 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index d0adf2e..a673fef 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,3 +56,22 @@ SOURCES = \
EXTRA_DIST += \
COPYING
+
+imagesdir = $(pkgdatadir)/images
+dist_images_DATA = \
+ assets/images/background.png \
+ assets/images/enemies.png \
+ assets/images/enemy-bullets.png \
+ assets/images/explosion.png \
+ assets/images/player-bullets.png \
+ assets/images/player.png
+
+soundsdir = $(pkgdatadir)/sounds
+dist_sounds_DATA = \
+ assets/sounds/energy-max.wav \
+ assets/sounds/explosion.wav \
+ assets/sounds/hit.wav \
+ assets/sounds/max-chain.wav \
+ assets/sounds/player-death.wav \
+ assets/sounds/player-missile.wav \
+ assets/sounds/player-shoot.wav
diff --git a/lisparuga.scm b/lisparuga.scm
index 06949cc..125fc55 100644
--- a/lisparuga.scm
+++ b/lisparuga.scm
@@ -105,6 +105,33 @@
(define-method (win-transition (lisparuga <lisparuga>))
(set! (state lisparuga) 'win))
+(define-method (pause-transition (lisparuga <lisparuga>))
+ (set! (state lisparuga) 'pause)
+ (pause (& lisparuga game))
+ (let ((container (make <node-2d>
+ #:name 'pause
+ #:rank 999)))
+ (attach-to container
+ (make <filled-rect>
+ #:region (make-rect 80.0 0.0 160.0 240.0)
+ #:color (make-color 0.0 0.0 0.0 0.4))
+ (make <label>
+ #:name 'pause
+ #:rank 1
+ #:text "PAUSE"
+ #:position (vec2 160.0 120.0)
+ #:align 'center
+ #:vertical-align 'center))
+ (attach-to lisparuga container)))
+
+(define-method (resume-transition (lisparuga <lisparuga>))
+ (set! (state lisparuga) 'play)
+ (detach (& lisparuga pause))
+ (resume (& lisparuga game))
+ (if (key-pressed? 'z)
+ (start-player-shooting (& lisparuga game))
+ (stop-player-shooting (& lisparuga game))))
+
(define-method (update (lisparuga <lisparuga>) dt)
(match (state lisparuga)
('play
@@ -130,6 +157,11 @@
(toggle-player-polarity (& lisparuga game))))
('c (unless repeat?
(fire-player-homing-missiles (& lisparuga game))))
+ ('return (pause-transition lisparuga))
+ (_ #t)))
+ ('pause
+ (match key
+ ('return (resume-transition lisparuga))
(_ #t)))
((or 'win 'game-over)
(match key
@@ -148,7 +180,7 @@
(define* (launch-lisparuga #:key (window-width 640) (window-height 480))
(boot-kernel (make <kernel>
#:window-config (make <window-config>
- #:title "Lisparuga"
+ #:title "lisparuga"
#:width window-width
#:height window-height))
(lambda () (make <lisparuga>))))
diff --git a/lisparuga/enemy.scm b/lisparuga/enemy.scm
index 9213890..dd298a6 100644
--- a/lisparuga/enemy.scm
+++ b/lisparuga/enemy.scm
@@ -98,13 +98,12 @@
(loop (+ i 1)))))))
(define-method (on-collision (enemy <enemy>) bullet bullet-polarity hitbox)
- ;; TODO: Distinguish between normal play bullets and homing shots
- ;; that do more damage.
- ;;
- ;; Same polarity = 1 point of damage
- ;; Opposite polarity = 2 points of damage
- (let ((same-polarity? (eq? bullet-polarity (polarity enemy))))
- (damage enemy (if same-polarity? 1 2))
+ ;; Same polarity = 1x damage
+ ;; Opposite polarity = 2x damage
+ (let* ((same-polarity? (eq? bullet-polarity (polarity enemy)))
+ (base-damage (if (eq? bullet ikaruga-missile) 10 1))
+ (multiplier (if same-polarity? 1 2)))
+ (damage enemy (* base-damage multiplier))
(when (and same-polarity? (dead? enemy))
(set! (fire-parting-shots? enemy) #t)))
#t)
diff --git a/lisparuga/game.scm b/lisparuga/game.scm
index bad080a..19e56ad 100644
--- a/lisparuga/game.scm
+++ b/lisparuga/game.scm
@@ -54,7 +54,7 @@
game-over?
complete?))
-(define-asset clouds (load-image (scope-asset "images/clouds.png")))
+;;(define-asset clouds (load-image (scope-asset "images/clouds.png")))
(define-asset player-bullet-atlas
(load-tile-atlas (scope-asset "images/player-bullets.png") 16 16))
(define-asset enemy-bullet-atlas
@@ -115,10 +115,10 @@
#:rank 999)))
(set! (rank player) 1)
(attach-to game
- (make <sprite>
- #:name 'clouds
- #:rank 0
- #:texture clouds)
+ ;; (make <sprite>
+ ;; #:name 'clouds
+ ;; #:rank 0
+ ;; #:texture clouds)
player
player-bullets
(make <node-2d>
@@ -240,7 +240,7 @@
(set! (stage-script game)
(run-script game
(do-intro game)
- ;;(do-tutorial game)
+ (do-tutorial game)
(do-phase-1 game)
(do-phase-2 game)
(toratsugumi-sweep game '((() (white white white) 45)