(set! moving #f)))
`((x . ,x) (y . ,y) (angle . ,angle) (moving . ,moving))))
+(define (ship-shot s)
+ (cond ((key-released? 'space)
+ #f)))
+
(define (make-asteroids n)
(define (xy n r)
(let ((n2 (- (random (* n 2)) n)))
(run-game
(set! asteroids (map move-asteroid asteroids))
(set! ship (move-ship ship))
- (set! shots (ship-shots
+ (let ((shot (ship-shot ship)))
+ (cond (shot
+ (set! shots (cons shot shots)))))
(for-each draw-asteroid asteroids)
(draw-ship ship)))
(glEnd))
(define (begin-draw number-of-points)
- (cond ((= number-of-points 3) (glBegin GL_TRIANGLES))
+ (cond ((= number-of-points 2) (glBegin GL_LINES))
+ ((= number-of-points 3) (glBegin GL_TRIANGLES))
((= number-of-points 4) (glBegin GL_QUADS))))
(define (draw-vertexes vertexes)
(height (texture-h texture)))
(draw-rectangle (* zoom width) (* zoom height) #:texture texture)))))
+(define* (draw-line length #:optional color)
+ (let ((l
+ (cond (color
+ (with-color color (draw v1 v2)))
+ (else
+ (draw v1 v2))))
+
(define* (draw-quad v1 v2 v3 v4 #:key texture color)
(cond (texture
(progn-textures