source: abuse/trunk/data/addon/leon/lisp/grenade.lsp @ 589

Last change on this file since 589 was 589, checked in by Sam Hocevar, 10 years ago

data: remove exact duplicate Lisp files, merge all main space Lisp files,
and move most frabs addons to the main data directory.

File size: 1.6 KB
Line 
1(setq GREN_SND (make-array 2 :initial-contents
2                             (list (def_sound "addon/leon/sfx/gren5.wav")
3                                   (def_sound "addon/leon/sfx/gren6.wav"))))
4
5(defun grenade_ai ()
6  (if (eq (hp) 6)
7    (set_yvel (- (yvel) 7) )
8  )
9  (set_yacel 3)
10  (if (eq (yvel) 0 )
11    (set_yvel (+ (yvel) 1) )
12    nil
13  )
14  (let ( (xv (xvel)) (yv (yvel)) (tk (tick)) )
15    (if (and (eq tk 1) (< xv 0) )
16      (progn
17        (set_xvel (- 0 xv) )
18        (play_sound (aref GREN_SND (random 2)) 127 (x) (y))
19      )
20      nil
21    )
22    (if (and (eq tk 2) (> xv 0) )
23      (progn
24        (set_xvel (- 0 xv) )
25        (play_sound (aref GREN_SND (random 2)) 127 (x) (y))
26      )
27      nil
28    )
29    (if (and (eq tk 4) (< yv 0) )
30      (progn
31        (set_yvel (* (/ yv 7) -5) )
32        (set_xvel (* (/ xv 7) 5) )
33        (play_sound (aref GREN_SND (random 2)) 127 (x) (y))
34      )
35      nil
36    )
37    (if (and (eq tk 8) (> yv 0) )
38      (progn
39        (set_yvel (- 0 yv) )
40        (set_xvel (* (/ xv 7) 5) )
41        (if (eq (yvel) 0 )
42          (set_xvel 0)
43          nil )
44        (set_gravity 1)
45        (play_sound (aref GREN_SND (random 2)) 127 (x) (y))
46      )
47      nil
48    )
49  )
50  (if (or (> (yvel) 0) (< (yvel) 0) (> (xvel) 0) (< (xvel) 0) )
51    (next_picture)
52    nil
53  )
54  (if (> (total_objects) 0)
55    (let ( (mex (x)) (mey (y)) )
56      (if (with_object (get_object 0) (find_object_in_area      (- mex 7)
57                                                                (- mey 7)
58                                                                (+ mex 7)
59                                                                (+ mey 7) bad_guy_list))
60
61        (set_hp 31)
62        nil
63      )
64    )
65  )
66  (if (> (hp) 30)
67    (progn
68      (do_explo 40 36)
69      nil
70    )
71    (progn
72      (add_hp 1)
73      T
74    )
75  )
76)
Note: See TracBrowser for help on using the repository browser.