Skip to content

Commit bf8543c

Browse files
feat: let Vector fire on scans
1 parent 5c0dc93 commit bf8543c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

bots/python/Vector/src/Vector.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
raise SystemExit(0)
99

1010
from robocode_tank_royale.bot_api.bot import Bot
11+
from robocode_tank_royale.bot_api.events import ScannedBotEvent
1112

1213

1314
class Vector(Bot):
@@ -19,6 +20,12 @@ def run(self) -> None:
1920
self.set_turn_right(30)
2021
self.forward(10_000)
2122

23+
def on_scanned_bot(self, event: ScannedBotEvent) -> None:
24+
"""Aim at the detected opponent and fire before continuing the scan."""
25+
self.turn_gun_right(self.gun_bearing_to(float(event.x), float(event.y)))
26+
self.fire(3)
27+
self.rescan()
28+
2229

2330
def main() -> None:
2431
Vector().start()

0 commit comments

Comments
 (0)