From ae60497f7722e01ccceebe799b5820717e048eb3 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 20 Oct 2021 18:42:10 -0400 Subject: Haven't committed in days, oops! --- bonnie-bee/popcorn.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 bonnie-bee/popcorn.scm (limited to 'bonnie-bee/popcorn.scm') diff --git a/bonnie-bee/popcorn.scm b/bonnie-bee/popcorn.scm new file mode 100644 index 0000000..8c70326 --- /dev/null +++ b/bonnie-bee/popcorn.scm @@ -0,0 +1,39 @@ +(define-module (bonnie-bee popcorn) + #: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 ()) + +(define-class ( )) + +(define-method (on-boot (popcorn )) + (attach-to popcorn + (make + #:texture popcorn-image + #:origin (vec2 16.0 16.0)))) + +(define-method (on-collide (popcorn ) (bullet )) + (if (player-bullet? bullet) + (begin + (damage popcorn 1) + (kill-bullet bullet) + #t) + #f)) + +(define-method (on-death (popcorn )) + (audio-play (asset-ref explosion-sound)) + (let ((p (position popcorn))) + (add-particle-emitter (particles (particles (parent popcorn))) + (make-particle-emitter (make-rect (vec2-x p) (vec2-y p) 1.0 1.0) + 4 3)))) -- cgit v1.2.3