[State 1000, Helper]
type = Helper
trigger1 = (time>0) && (time<20) && numhelper(19440)<20 && numhelper(19441)<20
helpertype = Normal
name = "GlassEffect"
id = 19440
pos = ceil(90-10*(random%15)),-120+ceil(random/40)
postype = p1
facing = 1
stateno = 19440
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

------------------------------------
;-------------------------------
; [HELPER] Glass Generator (Shards)

[Statedef 19440]
type = A
movetype = I
physics = N
anim = 15999

[State 1003, Helper]
type = Helper
trigger1 = !time
helpertype = Normal
name = "GlassEffect"
id = 19441
pos = 0,0
postype = p1
facing = 1
stateno = 19441
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1

[State 1003, DestroySelf]
type = DestroySelf
trigger1 = time=2

[Statedef 19441]
type = A
movetype = I
physics = N
anim = 19440 + (random%8)
velset = 0, 1+0.1*(random%8)
sprpriority = 9

[State 1005, VarRandom]
type = VarSet
trigger1 = !time
fvar(20) = random%2

[State 1004, assert]
type = angledraw
trigger1 = 1
value = ifelse(fvar(20)=1,5*time,-5*time)

[State 1004, assert]
type = assertspecial
trigger1 = 1
flag = noshadow

[State 1405, No hits]
type = NotHitBy
trigger1 = 1
value = SCA

[State 1416, Gravity]
type = Gravity
trigger1 = 1

[State 1415, Hit Floor]
type = ChangeState
trigger1 = Pos Y >= 0
value = 19442

;-------------------------------
;Touches the floor
[Statedef 19442]
type = A
movetype = A
physics = N
velset = ifelse(random%2,1.5+0.1*(random%10),-1.5-0.1*(random%10)), -3-(random%4)
sprpriority = 9

[State 1011, Override]
type = NotHitBy
trigger1 = 1
value = SCA

[State 1004, assert]
type = angledraw
trigger1 = 1
value = ifelse(vel X>0,5*time,-5*time)

[State 1416, Reset Pos]
type = PosSet
trigger1 = !Time
Y = 0

[State 1406, Gravity]
type = Gravity
trigger1 = 1

[State 1406, No Shadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1415, Hit Floor]
type = ChangeState
trigger1 = (Pos Y >= 0) && time>1
value = 19443

;-------------------------------
;Touches the floor
[Statedef 19443]
type = A
movetype = A
physics = N
sprpriority = 9

[State 1011, loop var]
type = Varadd
trigger1 = !time
var(33) = 1

[State 1011, time var]
type = Varadd
trigger1 = var(33)<3
var(12) = 1

[State 1011, Override]
type = NotHitBy
trigger1 = 1
value = SCA

[State 1011, vels]
type = Velset
trigger1 = !time && var(33)<3
Y = -3-(random%3)+var(33)

[State 1011, vels]
type = Velmul
trigger1 = 1
x = 0.98

[State 1004, assert]
type = angledraw
trigger1 = 1
value = ifelse(vel X>0,-5*var(12),5*var(12))
scale = 1,ifelse(var(33)<3,1,.5)

[State 1416, Reset Pos]
type = PosSet
trigger1 = !Time
Y = 0

[State 1406, Gravity]
type = Gravity
trigger1 = 1

[State 1406, No Shadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1406, Stop]
type = PosFreeze
trigger1 = Var(33)=3

[State 1415, Hit Floor]
type = ChangeState
trigger1 = (Pos Y >= 0) && time>1 && var(33)<3
value = 19443

[State 1415, destroy]
type = DestroySelf
trigger1 = root,stateno = 19450