I am making an AI tank game, but I have a problem.
when the AI tank is moving and firing at the same time (which is often), the "bullet" stays where the tank was for about 1/2 a second while the tank keeps moving, and then goes toward the target.
Are there any Ideas as to what I may be doing wrong?
Offline
i had that problem without a ai. heres a scriipt for the bullet that will fix it.
<when green flag clicked>
<forever>
<if><touching[ tank
<hide>
<else>
<show>
<end>
Last edited by AlanProjects (2008-08-01 18:30:25)
Offline
I tried that, but it didn't quite work.
here are my other scripts for the bullet:
[blocks]
<when green flag clicked>
<go to[ AI turret
and:
<when I receive[ AI fire
<show>
<glide( 0.9 )secs to x
non AI x )y
non AI y
<if><touching color[ non AI color
<broadcast[ AI hit
<go to[ AI turret
<hide>
<wait( 0.5 )secsc>
<else>
<go to[ AI turret
<hide>
<wait( 0.5 )secsc>
[/blocks]
Last edited by treko84 (2008-08-01 19:19:09)
Offline
i think, when you broadcast fire, it should effect both the turret and body, giving them a slight pause

Offline
I see another potential problem with this script. Because you use the glide block, the bullet does not actively check to see if it hit something and will only be able to register a hit at the coordinate determined before the shot is fired. This way, to avoid being hit the player would only have to move towards the enemy tank. Try using the move block like I did with my tank AI, this way it can actively check to see if it's hit, this may also fix the firing delay issue.
Offline
alright I'll try those things.
Sorry I haven't been on lately. I just got back from a 1-week vacation to see my grandparents.
the method I use for AI movement is an extended version of Sniper_rick's "tank wars" project.
Offline
OK, I tried what Bluestribute suggested, but it simply made the delay before firing worse. However, I found something that did work! I just added a "go to AI turret" block at the top of the bullet's script.
I'm still working on what SeanCanoodle suggested.
Thanks everyone!
Offline