# Expected vars: # NS (str), e.g. "spider_" # EYESPIDER (bool) # NOTE: make sure "stand" is the first anim, so any imports # should go below it # So we know we're not just a "spider-like" thing, e.g. coin_beast $SET_BOOL SPIDER # Should match the delays in anim/_roller.fus $SET_INT ROLLER_STAND_DELAY 1 import "anim/_spider_vars.fus" collmsgs: $IF !EYESPIDER: "touch" $IF !EYESPIDER: "enter_door" on "crush": goto: "dead" $IF !EYESPIDER: on "carryable": # "me" is a spider, "you" is a carryable thing (e.g. coin, food) if: not: exists myvar("carrying") then: # Transfer some vars from carryable thing to the spider who # will now be "carrying it" set myvar("carrying"): yourvar("carryable") set myvar("carrying_respawn_counter"): yourvar("respawn_counter") set myvar("label:carrying"): yourvar("carryable_rgraph") # Increment a var tracking how many of this thing are # being carried if: exists myvar("carrying_respawn_counter") then: inc mapvar(myvar("carrying_respawn_counter")) # When a thing is carried, it is "collected" as you: goto immediate: "_collected" proc onmapchange "mapchange": # Decrement a mapvar tracking how many of this thing are # being carried # (NOTE: this logic should match that for when spit "dies") if: exists myvar("carrying_respawn_counter") then: dec mapvar(myvar("carrying_respawn_counter")) # Unset "carrying" and related vars call: "_unset_carrying" proc "_unset_carrying": # Unsets "carrying" and related vars set myvar("carrying"): null set myvar("label:carrying"): null proc "_spawn_spit": # "me" is spider, "you" is spider's newly-spawned spit if: exists myvar("carrying") then: # Transfer the thing we're carrying over to our spit # Set spit's "carrying" to spider's "carrying" as you: set myvar("carrying"): yourvar("carrying") set myvar("carrying_respawn_counter"): yourvar("carrying_respawn_counter") set myvar("label:carrying"): yourvar("label:carrying") # Unset "carrying" and related vars call: "_unset_carrying" proc "spit": spawn: myvar("spit_anim") "fly" (0 0) 0 f do: call: "_spawn_spit" goto delay: "spit" proc "looking_up_spit": spawn: myvar("spit_anim") "fly" (1 0) 1 f do: call: "_spawn_spit" goto delay: "looking_up_spit" proc "crawl_spit": spawn: myvar("spit_anim") "crouch_fly" (0 0) 0 f do: call: "_spawn_spit" goto delay: "crawl_spit" proc "crawl_looking_up_spit": spawn: myvar("spit_anim") "crouch_fly" (1 0) 1 f do: call: "_spawn_spit" goto delay: "crawl_looking_up_spit" proc "swim_spit": spawn: myvar("spit_anim") "fly" (0 0) 0 f do: call: "_spawn_spit" goto delay: "swim_spit" collmap "stand": ;; . . ;; *\*/* ;; . - + - . ;; */*\* ;; (.) . collmap "crawl": ;; . ;; * ;; (.) . import "anim/_spider_stand.fus" import "anim/_spider_jump.fus" state "look_up": rgraph: $PREFIX NS "look_up" hitbox: collmap("stand") "default" if() then: goto: "looking_up" state "unlook_up": rgraph: $PREFIX NS "unlook_up" hitbox: collmap("stand") "default" if() then: goto: "stand" state "looking_up": rgraph: $PREFIX NS "looking_up" hitbox: collmap("stand") "spit" if: key: wentdown y then: call: "looking_up_spit" "jump" if: key: wasdown u coll: all no ;; *\*/* ;; - + - ;; \* ;; ;; ;; ( ) then: move: 1 0 rot: 1 goto immediate: "start_jump" "unlook_for_step" if: any: key: wasdown f key: wasdown b then: goto delay: "unlook_up" "crawl" if: key: wasdown d coll: all yes # Can only crawl when there's an edge under you. # This is significant for stickyspider. ;; (.)- . then: goto delay: "crawling_looking_up" "unlook" if: key: not isdown x then: goto delay: "unlook_up" state "spit": rgraph: $PREFIX NS "spit" hitbox: collmap("stand") "default" if() then: goto: "stand" state "looking_up_spit": rgraph: $PREFIX NS "looking_up_spit" hitbox: collmap("stand") "default" if() then: goto: "looking_up" state "turn": rgraph: $PREFIX NS "turn" hitbox: collmap("stand") "jump" if: key: wasdown u coll: all no ;; \*/* ;; + - ;; /*\* ;; ( ) then: move: 1 0 goto immediate: "start_jump" "default" if() then: goto immediate: "step" state "sleep": rgraph: $PREFIX NS "sleep" hitbox: collmap("crawl") "unsleep" if: any: key: wasdown u key: wasdown d key: wasdown l key: wasdown r then: goto: "crawl" $IF EYESPIDER: state "eye_closing": rgraph: $PREFIX NS "eye_closing" hitbox: collmap("stand") "default" if() then: goto: "eye_closed" state "eye_unclosing": rgraph: $PREFIX NS "eye_unclosing" hitbox: collmap("stand") "default" if() then: goto: "stand" state "eye_closed": rgraph: $PREFIX NS "eye_closed" hitbox: collmap("stand") "unclose_eye" if: key: not isdown x then: goto delay: "eye_unclosing" state "mostly_dead": rgraph: "dead_cycle" unsafe "default" if() then: die mostly state "dead": rgraph: "dead_cycle" unsafe "default" if() then: die import "anim/_spider_crawl.fus" import "anim/_spider_swim.fus"