1 2;; The 'init signal is sent after the instance is created. This is our chance 3;; to initialize fields to non-default values. Note: all the pclass values are 4;; defined in game.scm. 5(define (bridge-init kbridge) 6 (kern-obj-set-pclass kbridge pclass-bridge)) 7 8;; Define the interface for the type 9(define bridge-ifc 10 (ifc '() 11 (method 'init bridge-init))) 12 13;; Make an object type. This is like a "class" in OO languages. 14(mk-obj-type 'TF_ew_bridge ;; tag 15 "bridge" ;; name 16 s_ew_bridge ;; sprite 17 layer-tfeat ;; stacking layer 18 bridge-ifc ;; interface 19 ) 20 21(mk-obj-type 'TF_ns_bridge ;; tag 22 "bridge" ;; name 23 s_ns_bridge ;; sprite 24 layer-tfeat ;; stacking layer 25 bridge-ifc ;; interface 26 ) 27;; ---------------------------------------------------------------------------- 28;; mk-bridge -- 'dir' is the orientation, one of the four cardinal directions 29;; and should be prepended by a single tick when called, as in 'north 'south 30;; 'east and 'west 31;; ---------------------------------------------------------------------------- 32(define (mk-bridge dir) 33 (case dir 34 ((north) (bind (kern-mk-obj TF_ns_bridge 1) nil)) 35 ((south) (bind (kern-mk-obj TF_ns_bridge 1) nil)) 36 (else (bind (kern-mk-obj TF_ew_bridge 1) nil)))) 37