summaryrefslogtreecommitdiff
path: root/bonnie-bee/boss.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2021-10-20 20:57:28 -0400
committerDavid Thompson <dthompson@vistahigherlearning.com>2021-10-20 20:57:28 -0400
commitba887d36cd96e188771eda44ddfb7c31c9811fc0 (patch)
tree47ccd58137e7fb83251973bd392322417eb252c8 /bonnie-bee/boss.scm
parent2ea098590c71f240bf26a4174d50cdf69152d7b5 (diff)
Add placeholder boss battle.
Diffstat (limited to 'bonnie-bee/boss.scm')
-rw-r--r--bonnie-bee/boss.scm40
1 files changed, 40 insertions, 0 deletions
diff --git a/bonnie-bee/boss.scm b/bonnie-bee/boss.scm
new file mode 100644
index 0000000..d19f2c2
--- /dev/null
+++ b/bonnie-bee/boss.scm
@@ -0,0 +1,40 @@
+(define-module (bonnie-bee boss)
+ #:use-module (bonnie-bee actor)
+ #:use-module (bonnie-bee assets)
+ #:use-module (bonnie-bee bullet)
+ #:use-module (chickadee audio)
+ #:use-module (chickadee graphics particles)
+ #:use-module (chickadee math)
+ #:use-module (chickadee math rect)
+ #:use-module (chickadee math vector)
+ #:use-module (chickadee scripting)
+ #:use-module (chickadee utils)
+ #:use-module (oop goops)
+ #:use-module (starling asset)
+ #:use-module (starling node)
+ #:use-module (starling node-2d)
+ #:export (<boss>))
+
+(define-class <boss> (<grounded> <damageable> <actor>))
+
+(define-method (on-boot (boss <boss>))
+ (attach-to boss
+ (make <sprite>
+ #:texture beetle-image
+ #:origin (vec2 64.0 32.0))))
+
+(define-method (on-collide (boss <boss>) (bullet <bullet>))
+ (cond
+ ((player-primary-bullet? bullet)
+ (damage boss 1)
+ (kill-bullet bullet)
+ #t)
+ ((player-bomb-bullet? bullet)
+ (damage boss 10)
+ (kill-bullet bullet))
+ (else #f)))
+
+(define-method (on-death (boss <boss>))
+ (audio-play (asset-ref explosion-sound))
+ (add-particle-emitter (particles (particles (parent boss)))
+ (make-particle-emitter (world-hitbox boss) 20 30)))