From ebc1c54b8f184ff485561b7c039be368b6a9d2c9 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 10 Apr 2020 22:42:26 -0400 Subject: Day 1 progress. --- lisparuga/game.scm | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 lisparuga/game.scm (limited to 'lisparuga/game.scm') diff --git a/lisparuga/game.scm b/lisparuga/game.scm new file mode 100644 index 0000000..edd97fc --- /dev/null +++ b/lisparuga/game.scm @@ -0,0 +1,82 @@ +;;; Lisparuga +;;; Copyright © 2020 David Thompson +;;; +;;; Lisparuga is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published +;;; by the Free Software Foundation, either version 3 of the License, +;;; or (at your option) any later version. +;;; +;;; Lisparuga is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Lisparuga. If not, see . + +;;; Commentary: +;; +;; Game container. Handles all the state, logic, and rendering for +;; the game itself. +;; +;;; Code: + +(define-module (lisparuga game) + #:use-module (chickadee math rect) + #:use-module (chickadee math vector) + #:use-module (chickadee render color) + #:use-module (chickadee render texture) + #:use-module (lisparuga asset) + #:use-module (lisparuga bullets) + #:use-module (lisparuga config) + #:use-module (lisparuga node) + #:use-module (lisparuga node-2d) + #:use-module (lisparuga player) + #:use-module (oop goops) + #:export ( + steer-player + start-player-shooting + stop-player-shooting + toggle-player-polarity + fire-player-homing-missiles)) + +(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)) + +;; nodes needed: +;; enemies +;; enemy bullets +;; scrolling background +(define-class ()) + +(define-method (on-boot (game )) + (let* ((player-bullets (make + #:capacity 500 + #:texture-atlas player-bullet-atlas)) + (player (make-player player-bullets)) + (enemy-bullets (make + #:capacity 1000 + #:texture-atlas player-bullet-atlas))) + (attach-to game + (make + #:name 'clouds + #:texture clouds) + player + player-bullets + enemy-bullets))) + +(define-method (steer-player (game ) up? down? left? right?) + (steer (& game player) up? down? left? right?)) + +(define-method (start-player-shooting (game )) + (start-shooting (& game player))) + +(define-method (stop-player-shooting (game )) + (stop-shooting (& game player))) + +(define-method (toggle-player-polarity (game )) + (toggle-polarity (& game player))) + +(define-method (fire-player-homing-missiles (game )) + (fire-homing-missiles (& game player))) -- cgit v1.2.3