diff options
-rw-r--r-- | gui.py | 38 | ||||
-rw-r--r-- | installing.txt | 15 | ||||
-rw-r--r-- | strategy.py | 2 |
3 files changed, 45 insertions, 10 deletions
@@ -23,6 +23,9 @@ input = False bot_input = True clock = pygame.time.Clock() +marker = [(0,0),(0,0),(0,0)] +marker_updated = [True, True, True] + screensize=(1280, 800) screen=pygame.display.set_mode(screensize,HWSURFACE|DOUBLEBUF|RESIZABLE) @@ -49,6 +52,7 @@ def draw_box(rect, color, filled=False, global_coords=True): def draw_circle(pos, r, color, filled=False, global_coords=True): if global_coords: pos = world_to_win_pt(pos, c.player.center) + r = world_to_win_length(r) if filled: gfxdraw.filled_circle(screen, pos[0], pos[1], r, color) @@ -208,8 +212,22 @@ def clear_screen(): screen.fill((255,255,255)) +def draw_marker(pos, color, thick): + offset = 40 / math.sqrt(2.) + # offset = 15 + draw_line((pos[0]+offset, pos[1]+offset),(pos[0]-offset, pos[1]-offset), color) + draw_line((pos[0]-offset, pos[1]+offset),(pos[0]+offset, pos[1]-offset), color) + for r in [10,20,30,40]: + draw_circle(pos, r, color) + + +def draw_markers(): + colors=[(255,0,255),(255,255,0),(0,255,255)] + for i in [0, 1, 2]: + draw_marker(marker[i], colors[i], marker_updated[i]) + def draw_frame(): - global screen, movement, zoom, screensize, input, bot_input + global screen, movement, zoom, screensize, input, bot_input, marker, marker_updated pygame.event.pump() clock.tick() @@ -233,6 +251,9 @@ def draw_frame(): for cell in viruses: draw_cell(cell) + + draw_markers() + draw_leaderboard() total_mass = 0 @@ -258,9 +279,6 @@ def draw_frame(): elif not input and not bot_input: input = True bot_input = False - elif input and not bot_input: - input = True - bot_input = True else: input = False bot_input = True @@ -268,16 +286,16 @@ def draw_frame(): pygame.quit() if event.key == K_r: c.send_respawn() - if input: + if event.type == MOUSEBUTTONDOWN: + if event.button in [1,2,3]: + marker[event.button-1] = win_to_world_pt(event.pos, c.player.center) + marker_updated[event.button-1] = True + print("set marker "+str(event.button-1)+" to "+str(event.pos)) + if input: if event.type == KEYDOWN: if event.key == K_w: c.send_shoot() if event.key == K_SPACE: c.send_split() - if event.type == MOUSEBUTTONDOWN: - if event.button == 1: - c.send_split() - if event.button == 3: - c.send_shoot() if event.type == MOUSEMOTION: c.send_target(*win_to_world_pt(event.pos, c.player.center)) diff --git a/installing.txt b/installing.txt new file mode 100644 index 0000000..1c8e604 --- /dev/null +++ b/installing.txt @@ -0,0 +1,15 @@ +debian wheezy instructions: + + apt-get install python3 + apt-get install python3-pip + cd repo/ + ln -s agarnet/agarnet fuckthisshit + in main.py, change "from agarnet.agarnet import [...]" to + "from fuckthisshit import [...]" + pip-3.2 install websocket-client + there will be an error message about invalid syntax in + sock.send(u"<garbage here>"). Ignore it. + follow https://wiki.ubuntuusers.de/Pygame + do NOT use pip for installing pygame + + diff --git a/strategy.py b/strategy.py index d8efe4e..da50f9a 100644 --- a/strategy.py +++ b/strategy.py @@ -150,4 +150,6 @@ class Strategy: gui.draw_text(self.target, str(round(zipped[0][1], 2)), (0,0,0), draw_centered = True) + gui.draw_text(self.target, str(round(zipped[0][1], 2)), (0,0,0), draw_centered = True) + return self.target |