source: abuse/trunk/data-frabs/lisp/general.lsp @ 581

Last change on this file since 581 was 44, checked in by Sam Hocevar, 11 years ago
  • Importing abuse-frabs 2.10.
File size: 3.4 KB
Line 
1;; Copyright 1995 Crack dot Com,  All Rights reserved
2;; See licensing information for more details on usage rights
3
4(defun pusher_cons () (set_aistate 4))
5(defun pusher_ai ()
6  (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
7      (progn
8        (next_picture)
9        (if (touching_bg)
10            (let ((xamount
11                   (if (> (direction) 0)
12                       (aistate)
13                     (- 0 (aistate)))))
14              (with_object (bg) (try_move xamount 0)))))) T)
15
16
17(def_char PUSHER
18  (range 5 5)
19  (funs (ai_fun      pusher_ai)
20;       (draw_fun    dev_draw)
21        (constructor pusher_cons))
22  (fields ("aistate" pusher_speed))
23  (states "art/chars/push.spe"
24          (stopped (seq "push" 1 5))))
25
26(defun spring_cons () (set_yvel -15))
27(defun spring_ai ()
28  (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
29      (select (aistate)
30              (0
31               (if (touching_bg)
32                   (let ((add_yvel (yvel)))
33                     (play_sound SPRING_SOUND 127 (x) (y))
34                     (with_object (bg)
35                              (progn
36                                (set_yvel (+ (yvel) add_yvel))
37                                (if (eq (gravity) 0)
38                                    (progn
39                                      (set_state run_jump)
40                                      (set_gravity 1)))))
41                 (set_state running)
42                 (set_aistate 1))))
43          (1 (if (next_picture) nil
44               (progn
45                 (set_aistate 0)
46                 (set_state stopped))))))
47  T)
48
49
50
51(def_char SPRING
52  (range 5 5)
53  (funs (ai_fun      spring_ai)
54        (constructor spring_cons))
55  (fields ("yvel" spring_yvel))
56  (states "art/misc.spe"
57          (stopped "spri0004.pcx")
58          (running (rep "spri0001.pcx" 4))))
59
60(defun pr_draw ()
61  (draw_predator)
62
63  )
64 
65
66(defun train_ai ()
67  (if (eq (aistate) 0)
68      (if (activated)
69          (progn
70            (with_object (bg)
71                         (progn
72                           (if (local_player)           
73                               (show_help (get_train_msg (aitype))))
74                           (freeze_player 100)))                           
75            (set_aistate 1)
76            T)
77        T)
78    (if (eq (aistate) 100)
79        nil
80      (progn
81        (if (with_object (bg) (local_player))
82            (show_help (get_train_msg (aitype))))
83        (set_aistate (+ (aistate) 1))
84        T))))
85
86
87(def_char TRAIN_MSG
88  (funs (ai_fun train_ai)
89        (draw_fun dev_draw))
90  (fields ("aitype" train_msg_num))
91  (states "art/misc.spe"
92          (stopped "bubble")))
93       
94(defun sball_damage (amount from hitx hity push_xvel push_yvel)  ; transfer damage to lower half
95  (if (eq (state) stopped)
96      (progn
97        (set_aistate 1)
98        (set_state running))))
99
100
101(def_char SWITCH_BALL
102  (funs (damage_fun sball_damage)
103        (ai_fun do_nothing))
104  (flags (hurtable T))
105  (states "art/misc.spe"
106          (stopped (seq "swit" 1 9))
107          (running (seq "swit" 10 18))))
108
109(def_char POINTER
110  (funs (ai_fun do_nothing))
111  (states "art/misc.spe"
112          (stopped "pointer")))
113
114(defun shifter_cons ()
115  (set_xvel 300)
116  (set_yvel 300)
117  (set_xacel 0)
118  (set_yacel -1))
119
120(defun holder_ai ()
121  (select (total_objects)
122          (2
123           (let ((newx (+ (with_object (get_object 1) (x)) (xvel)))
124                 (newy (+ (with_object (get_object 1) (y)) (yvel))))
125             (with_obj0 (set_x newx) (set_y newy))
126             (set_x newx)
127             (set_y newy)
128             T))
129          (3 
130           (if (with_object (get_object 2) (not (eq (aistate) 0)))
131               (let ((newx (+ (with_object (get_object 1) (x)) (xvel)))
132                     (newy (+ (with_object (get_object 1) (y)) (yvel))))
133                 (with_obj0 (set_x newx) (set_y newy))
134                 (set_x newx)
135                 (set_y newy)
136                 T)
137             (if (eq (xacel) 1)
138                 nil
139               T)))
140          (4 T)
141          (5 T)
142          (6 T)
143          (0 nil)
144          (1 nil)))
145 
146
147(def_char OBJ_HOLDER
148  (funs (ai_fun holder_ai)
149        (draw_fun dev_draw))
150  (fields ("xvel"  obj_holder_xoff)
151          ("yvel"  obj_holder_xoff)
152          ("xacel" obj_holder_del))
153  (states "art/misc.spe"
154          (stopped "o_hold")))
Note: See TracBrowser for help on using the repository browser.