summaryrefslogtreecommitdiff
path: root/game.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2016-05-15 20:11:58 -0400
committerDavid Thompson <dthompson2@worcester.edu>2016-05-15 20:12:49 -0400
commit2fce9e80092c28b51d2d8795ca04fecb43aed277 (patch)
tree441744189ced3e8a14186f28555e0b28b13c6521 /game.scm
parent4bd5d6c93f6969fd417780b92cc5d2da4d699771 (diff)
Extract data types into their own modules.
Diffstat (limited to 'game.scm')
-rw-r--r--game.scm97
1 files changed, 17 insertions, 80 deletions
diff --git a/game.scm b/game.scm
index 0455300..2c9f257 100644
--- a/game.scm
+++ b/game.scm
@@ -1,19 +1,18 @@
-;;; Sly
-;;; Copyright (C) 2016 David Thompson <dthompson2@worcester.edu>
+;;; Lisparuga
+;;; Copyright © 2016 David Thompson <davet@gnu.org>
;;;
-;;; This program 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 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.
;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; 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 this program. If not, see
-;;; <http://www.gnu.org/licenses/>.
+;;; along with Lisparuga. If not, see <http://www.gnu.org/licenses/>.
(use-modules (ice-9 format)
(ice-9 match)
@@ -29,88 +28,26 @@
(sly render tileset)
(srfi srfi-1)
(srfi srfi-9)
- (srfi srfi-11))
+ (srfi srfi-11)
+ (lisparuga bullets)
+ (lisparuga enemies)
+ (lisparuga explosions)
+ (lisparuga player)
+ (lisparuga stats)
+ (lisparuga utils)
+ (lisparuga world))
;;;
;;; Model
;;;
-(define resolution (vector2 120 160))
(define bounds (make-rect (vector2 0 0) resolution))
(define player-bounds (rect-inflate bounds -6 -8))
(define bullet-bounds (rect-inflate bounds 32 32))
(define player-speed 1.1)
(define player-attack 1)
-(define origin2 (vector2 0 0))
-
-
-;;;
-;;; Data types
-;;;
-
-(define-record-type* <bullet>
- %make-bullet make-bullet
- bullet?
- (type bullet-type 'generic)
- (polarity bullet-polarity 'light)
- (live? bullet-live? #t)
- (position bullet-position origin2)
- (direction bullet-direction 0)
- (hitbox bullet-hitbox (make-rect -1 -1 1 1)))
-
-(define-record-type* <player>
- %make-player make-player
- player?
- (polarity player-polarity 'light)
- (position player-position (vector2 (/ (vx resolution) 2) 8))
- (direction player-direction (vector2 0 0))
- (shooting? player-shooting? #f)
- (hitbox player-hitbox (make-rect -1 1 2 4))
- (absorb-hitbox player-absorb-hitbox (make-rect -9 -2 16 6))
- (last-death-time player-last-death-time #f))
-
-(define-record-type* <enemy>
- %make-enemy make-enemy
- enemy?
- (position enemy-position origin2)
- (aim enemy-aim 0) ; angle for firing bullets
- ;; TODO: We could leave out the '-light' part and use the polarity
- ;; field to figure things out, but it's more work so forget it.
- (type enemy-type 'pincer-dark)
- (polarity enemy-polarity 'light)
- (hitbox enemy-hitbox (make-rect -5 -5 10 10))
- (last-hit-time enemy-last-hit-time #f)
- (health enemy-health 0))
-
-(define-record-type* <stats>
- %make-stats make-stats
- stats?
- (score stats-score 0)
- (lives stats-lives 3)
- (chain stats-chain 0)
- (chain-type stats-chain-type #f)
- (chain-progress stats-chain-progress 0))
-
-(define-record-type* <explosion>
- %make-explosion make-explosion
- explosion?
- (type explosion-type 'regular)
- (position explosion-position origin2)
- (time explosion-time 0))
-
-(define-record-type* <world>
- %make-world make-world
- world?
- (waves world-waves #f)
- (stats world-stats (make-stats))
- (player world-player (make-actor (make-player) idle))
- (player-bullets world-player-bullets '())
- (enemies world-enemies '())
- (enemy-bullets world-enemy-bullets '())
- (explosions world-explosions '()))
-
;;;
;;; Enemies