@name 
@inputs Space Active
@outputs Eject 
@persist Start H LOSE G LOWHEIGHT HIGHHEIGHT J:entity D:entity F:entity R:ranger
@trigger 

#print(HIGHHEIGHT)

if(first()){

    HIGHHEIGHT = randint(150,180)
    LOWHEIGHT = randint(5,-6)
    G = -30
    timer("loop",1)
    J = propSpawn("models/props_phx/misc/egg.mdl",0)

    holoCreate(1)
    holoScale(1,vec(10,0.1,10))
    holoPos(1,entity():pos() +vec(0,0,80))
    holoColor(1,vec(0,210,220))
    holoParent(1,entity())
    entity():setAng(ang(0,90,0))
    Start = 1
    H = 75
    #TOP - 133   # BOTTOM - 25 DEF - 100
    holoCreate(2)
    holoPos(2,entity():pos() + vec(0,30,75))
    holoColor(2,vec(255,0,0))
    LOSE = 0
    
    
    
    holoCreate(3)
    holoScale(3,vec(1,0.3,10))
    holoPos(3,entity():pos() + vec(0,-30,-6))
    holoColor(3,vec(0,255,0))
    
    
    
        holoCreate(4)
    holoScale(4,vec(1,0.3,10))
    holoPos(4,entity():pos() + vec(0,-30,170))
    holoColor(4,vec(0,255,0))
    
    
  #  D = propSpawn("models/hunter/blocks/cube025x2x025.mdl",1)
  #  F = propSpawn("models/hunter/blocks/cube025x2x025.mdl",1)
    D:setPos(entity():pos() + vec(-4,-25,160))
    D:setAng(holoEntity(1):angles() + ang(0,0,90))
        F:setPos(entity():pos() + vec(-4,-25,0))
    F:setAng(holoEntity(1):angles() + ang(0,0,90))
}


D:setPos(holoEntity(3):pos())
F:setPos(holoEntity(4):pos() + vec(-4,5,-15))

if(clk("loop")){
    if(!J){LOSE = 1}
        
if(Start==1){
    if(Active==1){
        if(H>25){ 
            G = G + 0.2
        holoPos(3,entity():pos() + vec(0,G,LOWHEIGHT))
            holoPos(4,entity():pos() + vec(0,G,HIGHHEIGHT))              
    H = H - 2
    holoPos(2,entity():pos() + vec(0,30,H))
}}}

if(G>50){    HIGHHEIGHT = randint(150,180)
    LOWHEIGHT = randint(5,-6)
    G = -30
}
    J:setPos(holoEntity(2):pos())

        if(H<25){
        LOSE = 1}
if(H>160){H=140}

if(LOSE==1){
    D:propBreak()
    F:propBreak()
            Eject = 1
    if(Active==0){

reset()}}

#rangerFilter(J)
#R = rangerOffset(J:toWorld(vec(0,0,1)),J:toWorld(vec(0,0,-1)))
#if(R:hit()){LOSE = 1}


timer("loop",1)
timer("space",100)





}


if(clk("space")){
if(Space==1){
    if(LOSE==0){
H = H + 40
holoEntity(2):soundPlay(100,100,"weapons/cbar_miss1.wav")
soundPitch(100,randint(100,150))

}
}
timer("space",100)
}
