summaryrefslogtreecommitdiff
path: root/lisparuga/player.scm
blob: ca6f49121c2a38c02ae44cd47a4ce7a5ee7dd955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;;; Lisparuga
;;; Copyright © 2016 David Thompson <davet@gnu.org>
;;;
;;; 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 <http://www.gnu.org/licenses/>.

(define-module (lisparuga player)
  #:use-module (sly records)
  #:use-module (sly math rect)
  #:use-module (sly math vector)
  #:use-module (lisparuga utils)
  #:export (make-player
            player?
            player-polarity
            player-position
            player-direction
            player-shooting?
            player-hitbox
            player-absorb-hitbox
            player-last-death-time))

(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))