-
Notifications
You must be signed in to change notification settings - Fork 3
/
levels.lisp
executable file
·116 lines (98 loc) · 3.72 KB
/
levels.lisp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
;;; Holy cow this is getting to be a mess here is where we shove the emitters
;;; for each level we will populate the enemies list from the main game each level
(cl:in-package :mds)
;;; TODO define some common patterns that can be pushed into the emitters
;;; This allows for very quick generation
(defun make-emitter (x y)
;; Generic function to make a simple version of our emitter
(make-instance 'emitter
:repeating t
:parent-x x
:parent-y y
:aim-player-func #'direction-to-player
:shot-push-func #'shot-adapter-function))
;; Level 1 (single emitter 7 arms swirley :) )
(defun level-1 ()
(setf (ready-at *scrape-ticker*) 50)
(let ((a (make-emitter (half-width) (* *height* .75))))
(dotimes (i 100)
(let ((percent (/ i 99.0)))
(push-burst a
:direction (* i percent)
:spread (* TAU 6/7)
:speed 4
:num-shots 7
:color (pick *GREEN* *BLUE*)
:step 5)))
(dotimes (i 10)
(push-burst a
:direction 'player
:spread TAU
:speed 5
:num-shots (+ i 10)
:color (if (oddp i) *YELLOW* *PURPLE*)
:step 3))
(vector-push-extend a *enemies*)))
(defun level-2 ()
(setf (ready-at *scrape-ticker*) 70)
(let ((a (make-emitter (* *width* .20) (* *height* .75)))
(b (make-emitter (* *width* .80) (* *height* .75)))
(c (make-emitter (half-width) (* *height* .75))))
(push-burst a :direction 'player :num-shots 4
:color *RED* :step 5 :spread (* PI .45)
:speed 10)
(push-burst b :direction 'player :num-shots 4
:color *BLUE* :step 5 :spread (* PI .45)
:speed 10)
(push-burst c :num-shots 1
:color *PURPLE*
:direction 'player
:step 50
:speed 1)
(dotimes (i 100)
(let ((dir (random TAU)))
(dotimes (j 4)
(push-burst c :direction dir
:color (pick *ORANGE* *YELLOW* *BLACK*)
:spread (* TAU 6/7)
:step 3
:num-shots 6
:speed 6))))
(vector-push-extend a *enemies*)
(vector-push-extend b *enemies*)
(vector-push-extend c *enemies*)))
(defun level-3 ()
(setf (ready-at *scrape-ticker*) 50)
(let ((a (make-emitter (* *width* .25) (* *height* .95)))
(b (make-emitter (* *width* .75) (* *height* .95)))
(sniper (make-emitter (half-width) (* *height* .80))))
(dotimes (line-count 100)
(push-burst a
:direction (random TAU)
:spread (* TAU 7/8)
:speed 5
:num-shots 7
:color (pick *BLUE* *TEAL*)
:step 6)
(push-burst b
:direction (random TAU)
:spread (* TAU 7/8)
:speed 5
:num-shots 7
:color (pick *YELLOW* *PURPLE*)
:step 6))
(push-burst sniper
:direction 'player
:spread 1
:speed 7
:num-shots 1
:color *RED*
:step 100)
(vector-push-extend sniper *enemies*)
(vector-push-extend a *enemies*)
(vector-push-extend b *enemies*)))
(defun setup-level-functions ()
(setf *level-functions* (make-array 1 :fill-pointer 0 :adjustable t))
(vector-push-extend #'level-1 *level-functions*)
(vector-push-extend #'level-2 *level-functions*)
(vector-push-extend #'level-3 *level-functions*))