**SPOOKY UNTESTED WIND-UP SALAMANDER CODE

reps 10
new: comp 2 21 1 "windupsalamander" 6 0 500
attr 198
bhvr 43
accg 5
elas 30
fric 100
perm 100
frat 2
tint 128 128 128 rand 0 255 rand 0 255
loop
setv va00 rand 2150 3829
setv va01 rand 1355 2360
untl tmvt va00 va01 eq 1
mvto va00 va01
repe

**ov00: Whether it's in the air.
**ov01: Walking time left.

**When it hits the ground, make noises and return to visible resting state.
scrp 2 21 1 6
	inst
	doif ov00 eq 1
		snde "yap1"
		mira rand 0 1
		setv ov00 0
		attr 198
		anim [0]
	elif ov01 gt 0
		subv ov01 1
		snde "yap1"
		anim [5 5 0]
		doif mira eq 0
			velo rand 10 15 rand -15 -10
		else
			velo rand -15 -10 rand -15 -10
		endi
	endi
endm

**When pushed, make a whole bunch of weird noises and enter invisible flipping up in the air state.
scrp 2 21 1 1
lock
	attr 214
	snde "wirr"
	wait 20
	doif crea from eq 1
		stim writ from 97 1
	endi
	over
	snde "boin"
	setv ov00 1
	velo rand -10 10 rand -40 -30
	anim [1 2 3 4 255]
	unlk
endm

**When pulled, start running around.
scrp 2 21 1 2
	inst
	snde "dog1"
	addv ov01 rand 5 20
	mira rand 0 1
	anim [5 5 0]
	doif mira eq 0
		velo rand 5 7 rand -5 -4
	else
		velo rand -7 -5 rand -5 -4
	endi
endm

**When hit, make noises and jump a little.
scrp 2 21 1 3
	snde "spnk"
	setv ov00 1
	velo rand -10 10 rand -15 -10
	anim [1 2 3 4 255]
endm
rscr

enum 2 21 1
	kill targ
next

scrx 2 21 1 6
scrx 2 21 1 1
scrx 2 21 1 2
scrx 2 21 1 3