1 | (defun zap (zapdam zapspd x y angle)
|
---|
2 | (with_object (add_object LASR_BULLET x y)
|
---|
3 | (progn
|
---|
4 | (setq sgb_lifetime 10)
|
---|
5 | (setq sgb_speed zapspd)
|
---|
6 | (setq sgb_dam zapdam)
|
---|
7 | (setq sgb_lastx (x))
|
---|
8 | (setq sgb_lasty (y))
|
---|
9 | (setq sgb_angle angle)
|
---|
10 | (setq sgb_bright_color (find_rgb 255 245 235))
|
---|
11 | (setq sgb_medium_color (find_rgb 150 145 140))
|
---|
12 | (if creator
|
---|
13 | (progn
|
---|
14 | (setq sgb_speed (+ sgb_speed (/ (xvel) 2)))
|
---|
15 | (link_object creator)))
|
---|
16 | (sgun_ai)
|
---|
17 | ))
|
---|
18 | )
|
---|
19 |
|
---|
20 | (defun fire_object (creator type x y angle target)
|
---|
21 | (select type
|
---|
22 |
|
---|
23 | (0 (with_object (add_object SHOTGUN_BULLET x y)
|
---|
24 | (progn
|
---|
25 | (play_sound ZAP_SND 127 (x) (y))
|
---|
26 | (setq sgb_lifetime 6)
|
---|
27 | (setq sgb_speed 15)
|
---|
28 | (setq sgb_lastx (x))
|
---|
29 | (setq sgb_lasty (y))
|
---|
30 | (setq sgb_angle angle)
|
---|
31 | (setq sgb_bright_color (find_rgb 255 255 200))
|
---|
32 | (setq sgb_medium_color (find_rgb 150 150 0))
|
---|
33 | (if creator
|
---|
34 | (progn
|
---|
35 | (setq sgb_speed (+ sgb_speed (/ (xvel) 2)))
|
---|
36 | (link_object creator)))
|
---|
37 | (sgun_ai)
|
---|
38 | )))
|
---|
39 | (1 (with_object (add_object SHOTGUN_BULLET x y)
|
---|
40 | (progn
|
---|
41 | (play_sound ZAP_SND 127 (x) (y))
|
---|
42 | (setq sgb_lifetime 40)
|
---|
43 | (setq sgb_speed 6)
|
---|
44 | (setq sgb_lastx (x))
|
---|
45 | (setq sgb_lasty (y))
|
---|
46 | (setq sgb_angle angle)
|
---|
47 |
|
---|
48 | (setq sgb_bright_color (find_rgb 255 128 64))
|
---|
49 | (setq sgb_medium_color (find_rgb 255 0 0))
|
---|
50 | (if creator
|
---|
51 | (progn
|
---|
52 | (setq sgb_speed (+ sgb_speed (/ (xvel) 2)))
|
---|
53 | (link_object creator)))
|
---|
54 | (sgun_ai)
|
---|
55 | )))
|
---|
56 | (2 (with_object (add_object GRENADE x y)
|
---|
57 | (progn
|
---|
58 | (play_sound GRENADE_THROW 127 x y)
|
---|
59 | (set_course angle 20)
|
---|
60 | (if creator
|
---|
61 | (progn
|
---|
62 | (link_object creator)
|
---|
63 | (set_xvel (+ (xvel) (with_object creator (xvel))))
|
---|
64 | (set_yvel (+ (yvel) (with_object creator (yvel))))
|
---|
65 | ))
|
---|
66 |
|
---|
67 | (set_frame_angle 0 359 angle)
|
---|
68 | )))
|
---|
69 | (3 (with_object (add_object ROCKET x y)
|
---|
70 | (progn
|
---|
71 | (play_sound ROCKET_LAUNCH_SND 127 x y)
|
---|
72 | (set_aistate angle)
|
---|
73 | (if creator (link_object creator))
|
---|
74 |
|
---|
75 | (if (and target ;; don't link if not in line of site
|
---|
76 | (can_see (x) (y)
|
---|
77 | (with_object target (x))
|
---|
78 | (with_object target (y)) nil))
|
---|
79 | (link_object target))
|
---|
80 |
|
---|
81 | (set_frame_angle 0 359 angle)
|
---|
82 | (setq speed 5)
|
---|
83 | (if (and creator (with_object creator (isa_player)))
|
---|
84 | (setq max_speed 14)
|
---|
85 | (setq max_speed 10))
|
---|
86 | (set_y (+ (y) (/ (picture_height) 2))) ;; move down to match frame/pos
|
---|
87 | )))
|
---|
88 |
|
---|
89 | (4 (with_object (add_object PLASMAGUN_BULLET x y)
|
---|
90 | (progn
|
---|
91 | (play_sound PLASMA_SND 127 (x) (y))
|
---|
92 | (setq sgb_lastx (x))
|
---|
93 | (setq sgb_lasty (y))
|
---|
94 | (if creator
|
---|
95 | (link_object creator))
|
---|
96 | (set_course angle 200)
|
---|
97 | (let ((old_x (x))
|
---|
98 | (old_y (y))
|
---|
99 | (bx (bmove (if (> (total_objects) 0) (get_object 0) nil))))
|
---|
100 | (if (not (eq bx T))
|
---|
101 | (if (eq bx nil)
|
---|
102 | (add_object EXPLODE5 (- (x) (random 5))
|
---|
103 | (- (y) (random 5)) 0)
|
---|
104 | (progn
|
---|
105 | (add_object EXPLODE3 (- (x) (random 5))
|
---|
106 | (- (y) (random 5)) 0)
|
---|
107 | (do_damage 10 bx (* (cos sgb_angle) 20)
|
---|
108 | (* (sin sgb_angle) 10)))))
|
---|
109 | (setq sgb_lastx (x))
|
---|
110 | (setq sgb_lasty (y))
|
---|
111 | (set_x old_x)
|
---|
112 | (set_y old_y))
|
---|
113 | )))
|
---|
114 |
|
---|
115 |
|
---|
116 | (5 (with_object (add_object FIREBOMB x y)
|
---|
117 | (progn
|
---|
118 | (play_sound FIREBOMB_SND 127 (x) (y))
|
---|
119 | (set_course angle 20)
|
---|
120 | (if creator
|
---|
121 | (progn
|
---|
122 | (link_object creator)
|
---|
123 | (set_yvel (+ (yvel) (with_object creator (yvel))))
|
---|
124 | )))))
|
---|
125 |
|
---|
126 | (6 (with_object (add_object DFRIS_BULLET x y)
|
---|
127 | (progn
|
---|
128 | (play_sound ROCKET_LAUNCH_SND 127 x y)
|
---|
129 | (set_course angle 25)
|
---|
130 | (set_aistate angle)
|
---|
131 | (if creator
|
---|
132 | (link_object creator))
|
---|
133 | (dfris_ai)
|
---|
134 | )))
|
---|
135 |
|
---|
136 | (7 (with_object (add_object LSABER_BULLET x y)
|
---|
137 | (progn
|
---|
138 | (play_sound LSABER_SND 127 (x) (y))
|
---|
139 | (setq sgb_lastx (x))
|
---|
140 | (setq sgb_lasty (y))
|
---|
141 | (if creator
|
---|
142 | (link_object creator))
|
---|
143 | (set_course angle 45)
|
---|
144 | (let ((bx (bmove (if (> (total_objects) 0) (get_object 0) nil))))
|
---|
145 | (if (not (eq bx T))
|
---|
146 | (if (not (eq bx nil))
|
---|
147 | (do_damage 30 bx (* (cos sgb_angle) 20)
|
---|
148 | (* (sin sgb_angle) 10)))))
|
---|
149 | )))
|
---|
150 |
|
---|
151 |
|
---|
152 | (9 (with_object (add_object STRAIT_ROCKET x y)
|
---|
153 | (progn
|
---|
154 | (play_sound MGUN_SND 127 (x) (y))
|
---|
155 | (if creator
|
---|
156 | (link_object creator))
|
---|
157 | (set_aistate angle)
|
---|
158 | (set_frame_angle 0 359 angle)
|
---|
159 | (play_sound GRENADE_THROW 127 (x) (y)))))
|
---|
160 |
|
---|
161 | (10 (with_object (add_object SHOTGUN_BULLET x y)
|
---|
162 | (progn
|
---|
163 | (play_sound ZAP_SND 127 (x) (y))
|
---|
164 | (setq sgb_lifetime 6)
|
---|
165 | (setq sgb_speed 15)
|
---|
166 | (setq sgb_lastx (x))
|
---|
167 | (setq sgb_lasty (y))
|
---|
168 | (setq sgb_angle angle)
|
---|
169 | (setq sgb_bright_color (find_rgb 255 0 0))
|
---|
170 | (setq sgb_medium_color (find_rgb 150 0 0))
|
---|
171 | (if creator
|
---|
172 | (progn
|
---|
173 | (setq sgb_speed (+ sgb_speed (/ (xvel) 2)))
|
---|
174 | (link_object creator)))
|
---|
175 | (sgun_ai)
|
---|
176 | )))
|
---|
177 | (11
|
---|
178 | (play_sound SHIP_ZIP_SND 127 (x) (y))
|
---|
179 | (zap 8 18 x y angle)
|
---|
180 | )
|
---|
181 | (12
|
---|
182 | (play_sound SHIP_ZIP_SND 127 (x) (y))
|
---|
183 | (zap 8 22 x y angle)
|
---|
184 | (zap 8 22 x y (+ angle 14))
|
---|
185 | (zap 8 22 x y (- angle 14))
|
---|
186 | )
|
---|
187 | (13
|
---|
188 | (play_sound SHIP_ZIP_SND 127 (x) (y))
|
---|
189 | (zap 6 24 x y angle)
|
---|
190 | (zap 6 20 x y (+ angle 15))
|
---|
191 | (zap 6 20 x y (- angle 15))
|
---|
192 | (zap 6 16 x y (+ angle 30))
|
---|
193 | (zap 6 16 x y (- angle 30))
|
---|
194 | )
|
---|
195 | )
|
---|
196 | )
|
---|
197 |
|
---|
198 | (defun las_ai ()
|
---|
199 | (setq sgb_lastx (x))
|
---|
200 | (setq sgb_lasty (y))
|
---|
201 | (set_course sgb_angle sgb_speed)
|
---|
202 | (if (eq sgb_lifetime 0)
|
---|
203 | nil
|
---|
204 | (let ((bx (bmove (if (> (total_objects) 0) (get_object 0) nil)))) ; don't hit the guy who fired us.
|
---|
205 | (setq sgb_lifetime (- sgb_lifetime 1))
|
---|
206 | (if (eq bx T) T
|
---|
207 | (progn
|
---|
208 | (setq sgb_lifetime 0) ;; disappear next tick
|
---|
209 | (if (eq bx nil)
|
---|
210 | (add_object EXPLODE3 (- (x) (random 5)) (- (y) (random 5)) 0)
|
---|
211 | (progn
|
---|
212 | (add_object EXPLODE6 (- (x) (random 5)) (- (y) (random 5)) 0)
|
---|
213 | (do_damage sgb_dam bx (* (cos sgb_angle) 10) (* (sin sgb_angle) 10))))))
|
---|
214 | T)))
|
---|
215 |
|
---|
216 | (def_char LASR_BULLET
|
---|
217 | (vars sgb_speed sgb_angle sgb_lastx sgb_lasty
|
---|
218 | sgb_bright_color sgb_medium_color sgb_lifetime sgb_dam)
|
---|
219 | (funs (ai_fun las_ai)
|
---|
220 | (user_fun sgun_ufun)
|
---|
221 | (draw_fun sgun_draw))
|
---|
222 | (range 10000 10000)
|
---|
223 | (flags (unlistable T)
|
---|
224 | (add_front T))
|
---|
225 | (states "art/misc.spe" (stopped "sgun_bullet")))
|
---|