I'm with Frank and ChrML on this one. Use a type field of "enemy_type" - much cleaner and easier to understand in the long run if you have loads of enemies.
Function update_player(p.player)
for c.enemy = each enemy
select c\enemy_type
case 1 ;enemy 1
If EntityDistance(c\model,p\model)<6 and AnimTime (p\model)>=4 and AnimTime (p\model)<=4.2
MoveEntity c\model,0,.3,-3;punch knocks enemy back
PlaySound(hit)
c\health = c\health-10
EndIf
case 2 ; enemy 2
If EntityDistance(c\model,p\model)<5 and AnimTime (p\model)>=4 and AnimTime (p\model)<=4.2
MoveEntity c\model,0,.3,-2
PlaySound(ouch)
c\health = c\health-10
endif
case 3 ; enemy 3 etc....
end select
next
end function
Function update_player(p.player)
for c.enemy = each enemy
select c\enemy_type
case 1 ;enemy 1
If EntityDistance(c\model,p\model)<6 and AnimTime (p\model)>=4 and AnimTime (p\model)<=4.2
MoveEntity c\model,0,.3,-3;punch knocks enemy back
PlaySound(hit)
c\health = c\health-10
EndIf
case 2 ; enemy 2
If EntityDistance(c\model,p\model)<5 and AnimTime (p\model)>=4 and AnimTime (p\model)<=4.2
MoveEntity c\model,0,.3,-2
PlaySound(ouch)
c\health = c\health-10
endif
case 3 ; enemy 3 etc....
end select
next
end function