Re: getTime() help
fnl <[email protected]>
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
The two methods onMissedBullet() and getTime() are very different. The getTime() method return the current turn/time (similar to "now"). The method onMissedBullet() gives you the chance to handle the situation where a MissedBulletEvent has occurred as one of your bullets has left the battle field. This method is handy if, and only if you keep track of your bullet(s) and want to discontinue tracking the bullet you fired previously using the 'Bullet setFire(bulletPower)' method. If you want to know when you fired the bullet that missed, you'll need to record somewhere that you fired bullet X at turn Y. This could be a Map<Bullet, Long>, where the Long is for the turn. Cheers, - Flemming Den lørdag den 15. marts 2014 22.12.53 UTC+1 skrev joshua mensink: > > I don't understand how the time works in Robocode. I'm trying to get my > robot to turn around if my robot misses more than 2 shots within a second > or two. How do I use the getTime() method with the onMissedBullet. > -- You received this message because you are subscribed to the Google Groups "robocode" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.