@name FailCake Wolf
@persist [E O]:entity Health Alpha Turn
@persist Angy Speed
@trigger all

function void moveWolf(AS:number){
 
if(Speed > 1){   
Speed-=1
}

if(AS == 1){
holoPos(1,holoEntity(1):pos() + -holoEntity(1):right()/Speed)
}elseif(AS == 2){
holoPos(1,holoEntity(1):pos() + holoEntity(1):right()/Speed)
}

}


function void hPEMU(HP:number){
Mu = cos(curtime()*10)*HP/12
holoAng(19,holoEntity(1):toWorld(ang(0,0,Mu-70)))    
}



function void animLegs(Lol:number){
    
if(Lol == 1){
Legs = cos(curtime()*50)*3 
}elseif(Lol == 2){
Legs = cos(curtime()*580)*6 
}
  
holoAng(13,holoEntity(1):toWorld(ang(0,0,Legs)))
holoAng(14,holoEntity(1):toWorld(ang(0,0,-Legs)))
holoAng(15,holoEntity(1):toWorld(ang(0,0,Legs)))
holoAng(16,holoEntity(1):toWorld(ang(0,0,-Legs)))
}


function void parents(){

## ParentHead
holoParent(17,1) # Unparent in sit
holoParent(3,17)
holoParent(4,3)
holoParent(5,3)
holoParent(6,3)

holoParent(2,1)

# PARENTS TAIL
holoParent(12,1) # Unparent in sit
holoParent(19,1)
holoParent(11,19)

# Parents Feet Front

holoParent(9,13)
holoParent(10,14)
holoParent(13,1) # Unparent in sit
holoParent(14,1) # Unparent in sit

# Parents Feet Back

holoParent(7,15)
holoParent(8,16)
holoParent(15,1) # Unparent in sit
holoParent(16,1) # Unparent in sit

holoParent(18,1)
}

function void walks(){
## BODy

holoCreate(1)
holoModel(1,"cube")
holoScaleUnits(1,vec(10,15,10))    
holoPos(1,E:toWorld(vec(0,0,15)))

# FURR
holoCreate(2)
holoModel(2,"cube")
holoScaleUnits(2,vec(13,10,13))    
holoPos(2,E:toWorld(vec(0,12,15)))


## HEAD
holoCreate(3)
holoModel(3,"cube")
holoScaleUnits(3,vec(10,7,10))    
holoPos(3,E:toWorld(vec(0,20,15)))

## hEARS
holoCreate(4)
holoModel(4,"cube")
holoScaleUnits(4,vec(3,1,3))    
holoPos(4,E:toWorld(vec(3,20,21)))

holoCreate(5)
holoModel(5,"cube")
holoScaleUnits(5,vec(3,1,3))    
holoPos(5,E:toWorld(vec(-3,20,21)))

# NOSE
holoCreate(6)
holoModel(6,"cube")
holoScaleUnits(6,vec(4,5,4))    
holoPos(6,E:toWorld(vec(0,25,14)))

## FEETS BACK##
holoCreate(7)
holoModel(7,"cube")
holoScaleUnits(7,vec(3,3,12))    
holoPos(7,E:toWorld(vec(2.5,-4,5)))

holoCreate(8)
holoModel(8,"cube")
holoScaleUnits(8,vec(3,3,12))    
holoPos(8,E:toWorld(vec(-2.5,-4,5)))

## FEETS FRONT##

holoCreate(9)
holoModel(9,"cube")
holoScaleUnits(9,vec(3,3,12))    
holoPos(9,E:toWorld(vec(2.5,12,5)))

holoCreate(10)
holoModel(10,"cube")
holoScaleUnits(10,vec(3,3,12))    
holoPos(10,E:toWorld(vec(-2.5,12,5)))

# TAIL - AKA HEALTH

holoCreate(11)
holoModel(11,"cube")
holoScaleUnits(11,vec(3,3,14))    
holoPos(11,E:toWorld(vec(0,-7,10)))
holoAng(11,ang(0,0,0))


## Feet 1 FRONT control

holoCreate(13)
holoModel(13,"cube")
holoScaleUnits(13,vec(4,4,4))  
holoAlpha(13,Alpha)
holoColor(13,vec(255,0,0))   
holoPos(13,E:toWorld(vec(2.5,12,11)))  

## Feet 2 FRONT control
holoCreate(14)
holoModel(14,"cube")
holoScaleUnits(14,vec(4,4,4))  
holoAlpha(14,Alpha)
holoColor(14,vec(255,0,0))   
holoPos(14,E:toWorld(vec(-2.5,12,11)))  


## Feet 1 BACK control

holoCreate(15)
holoModel(15,"cube")
holoScaleUnits(15,vec(4,4,4))  
holoAlpha(15,Alpha)
holoColor(15,vec(255,0,0))   
holoPos(15,E:toWorld(vec(2.5,-4,11)))  

## Feet 2 BACK control
holoCreate(16)
holoModel(16,"cube")
holoScaleUnits(16,vec(4,4,4))  
holoAlpha(16,Alpha)
holoColor(16,vec(255,0,0))   
holoPos(16,E:toWorld(vec(-2.5,-4,11)))  

## HEAD controler
holoCreate(17)
holoModel(17,"cube")
holoScaleUnits(17,vec(4,4,4))  
holoAlpha(17,Alpha)
holoColor(17,vec(255,0,0))   
holoPos(17,E:toWorld(vec(0,17,15)))  

## BODY (SIT) controler
holoCreate(18)
holoModel(18,"cube")
holoScaleUnits(18,vec(4,4,4))  
holoAlpha(18,Alpha)
holoColor(18,vec(255,0,0))   
holoPos(18,E:toWorld(vec(0,7,15)))  

## TAIL controler
holoCreate(19)
holoModel(19,"cube")
holoScaleUnits(19,vec(4,4,4))  
holoAlpha(19,Alpha)
holoColor(19,vec(255,0,0))   
holoPos(19,E:toWorld(vec(0,-7,16)))  

parents()
}

if(first() | duped()){
runOnTick(1)

E = entity()
O = owner()
Health = 100
Alpha = 0 # DEBUG
walks()
Speed = 10
## Ang Def
}

hPEMU(Health)

moveWolf(1) 
animLegs(2)   


