From 07670ef8afb5a273267ea7149d5f7eef02fdf66b Mon Sep 17 00:00:00 2001 From: Lizzy Hunt Date: Fri, 12 Jan 2024 19:13:13 -0700 Subject: add subprojects --- centipede/js/game/objects/bullet.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 centipede/js/game/objects/bullet.js (limited to 'centipede/js/game/objects/bullet.js') diff --git a/centipede/js/game/objects/bullet.js b/centipede/js/game/objects/bullet.js new file mode 100644 index 0000000..5791aca --- /dev/null +++ b/centipede/js/game/objects/bullet.js @@ -0,0 +1,11 @@ +game.Bullet = (spec) => { + const object = game.Object(spec); + const parentUpdate = object.update; + object.update = (elapsedTime) => { + parentUpdate(elapsedTime); + if (object.y < 0) { + object.alive = false; + } + }; + return object; +} \ No newline at end of file -- cgit v1.2.3-70-g09d2