Hi there everybody!
It's been a little while since i sat down infront of my computer and a even longer while since i programmed. Becdause i have joined the army now...
Anyway i have one week vacation now and i wreally need some help with my game. Here's the problem:
When i fire my gun a small hole appears on the walls of the map. These small holes dissapear after a while and im happy about it.
But if i hit one of my zombies the hole attaches to an invisible square (not on a polygon) and most importently i cant kill the zombie! I think it has something to do with me using CameraPick ... heres the code...
If (Timer_Fire# + 200) < MilliSecs()
Shot = CameraPick(camera,(ScreenWidth/2),ScreenHeight/2))
If Shot
Hit(PickedX(),PickedY(),PickedZ())
EndIf
Timer_Fire# = MilliSecs()
EndIf
Function Hit(x#,y#,z#)
For Zombie.Zombies = Each Zombies
If ((Zombie\X# = x#) And (Zombie\Y# = y#) And (Zombie\Z# = z#))
Then
If Zombie\Life# <= 0 Then
FreeEntity(Zombie\Ent)
Delete Zombie
Else
Zombie\Life# = (Zombie\Life# - (30 + (Degree * 15)))
EndIf
EndIf
Next
---
And this is a zombie:
Zombie.Zombies = New Zombies
Zombie\ID = I
Zombie\X# = Rnd(-126.0,65.0)
Zombie\Y# = 1
Zombie\Z# = Rnd(64,167)
Zombie\Life# = 100.0
Zombie\DestinationX# = 0.0
Zombie\DestinationY# = 0.0
Zombie\DestinationZ# = 0.0
Zombie\Ent = LoadMD2("gfx/Zombie/Zombie.md2")
Zombie\Tex = LoadTexture("gfx/Zombie/Zombie.bmp")
EntityTexture Zombie\Ent,Zombie\Tex
ScaleEntity Zombie\Ent,0.2,0.2,0.2
EntityType Zombie\Ent,Col_Zombie
EntityPickMode Zombie\Ent,Pic_Zombie
ScaleEntity Zombie\Ent,0.05,0.05,0.05
EntityColor Zombie\Ent,Rand(1,255),Rand(1,255),Rand(1,255)
PositionEntity(Zombie\Ent,Zombie\X#,Zombie\Y#,Zombie\Z#)
End Function
I think it all has something to do with the "EntityPickMode".
Please help me my zombies wont die!
It's been a little while since i sat down infront of my computer and a even longer while since i programmed. Becdause i have joined the army now...
Anyway i have one week vacation now and i wreally need some help with my game. Here's the problem:
When i fire my gun a small hole appears on the walls of the map. These small holes dissapear after a while and im happy about it.
But if i hit one of my zombies the hole attaches to an invisible square (not on a polygon) and most importently i cant kill the zombie! I think it has something to do with me using CameraPick ... heres the code...
If (Timer_Fire# + 200) < MilliSecs()
Shot = CameraPick(camera,(ScreenWidth/2),ScreenHeight/2))
If Shot
Hit(PickedX(),PickedY(),PickedZ())
EndIf
Timer_Fire# = MilliSecs()
EndIf
Function Hit(x#,y#,z#)
For Zombie.Zombies = Each Zombies
If ((Zombie\X# = x#) And (Zombie\Y# = y#) And (Zombie\Z# = z#))
Then
If Zombie\Life# <= 0 Then
FreeEntity(Zombie\Ent)
Delete Zombie
Else
Zombie\Life# = (Zombie\Life# - (30 + (Degree * 15)))
EndIf
EndIf
Next
---
And this is a zombie:
Zombie.Zombies = New Zombies
Zombie\ID = I
Zombie\X# = Rnd(-126.0,65.0)
Zombie\Y# = 1
Zombie\Z# = Rnd(64,167)
Zombie\Life# = 100.0
Zombie\DestinationX# = 0.0
Zombie\DestinationY# = 0.0
Zombie\DestinationZ# = 0.0
Zombie\Ent = LoadMD2("gfx/Zombie/Zombie.md2")
Zombie\Tex = LoadTexture("gfx/Zombie/Zombie.bmp")
EntityTexture Zombie\Ent,Zombie\Tex
ScaleEntity Zombie\Ent,0.2,0.2,0.2
EntityType Zombie\Ent,Col_Zombie
EntityPickMode Zombie\Ent,Pic_Zombie
ScaleEntity Zombie\Ent,0.05,0.05,0.05
EntityColor Zombie\Ent,Rand(1,255),Rand(1,255),Rand(1,255)
PositionEntity(Zombie\Ent,Zombie\X#,Zombie\Y#,Zombie\Z#)
End Function
I think it all has something to do with the "EntityPickMode".
Please help me my zombies wont die!