type stuff

Blitz3D Forums/Blitz3D Programming/type stuff

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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