Discussion:
getTime() help
joshua mensink
2014-03-15 21:12:53 UTC
Permalink
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 robocode+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
fnl
2014-03-16 21:27:17 UTC
Permalink
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
Post by 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 robocode+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...