]> git.jsancho.org Git - gacela.git/blob - game.lisp
(no commit message)
[gacela.git] / game.lisp
1 (show-mob (make-mob :x 0 :y 0 :image (filled-rect 5 420) :tags '(wall)))
2 (show-mob (make-mob :x 635 :y 0 :image (filled-rect 5 420) :tags '(wall)))
3 (show-mob (make-mob :x 0 :y 0 :image (filled-rect 640 5) :tags '(wall)))
4
5 (show-mob (make-mob :x 280 :y 420 :image (filled-rect 80 20) :tags '(wall)
6                     :logic (movement-with-cursors :xvel 200 :yvel 0)))
7
8 (let ((xvel 100) (yvel -100))
9   (show-mob (make-mob :x 300 :y 200 :image (filled-circle 7)
10                       :logic (progn
11                                (cond ((> y 480) (setq x 300 y 200 xvel 100 yvel -100))
12                                      (t (let ((c (collision '(wall))))
13                                           (cond ((null c) nil)
14                                                 ((= c (neg (/ pi 2))) (setq yvel (neg (- yvel 10))))
15                                                 ((= c (/ pi 2)) (setq yvel (neg (+ yvel 10))))
16                                                 ((= c 0) (setq xvel (neg (+ xvel 10))))
17                                                 ((= c pi) (setq xvel (neg (- xvel 10))))))))
18                                (movement :xvel xvel :yvel yvel)))))
19
20 (run-game)
21 (quit-game)