import NetworkHandler as net import ClassHandler as ch import GraphicsHelper as gh import ResourceLoader as rs import AIhandler as AIH import json import pygame import threading import random SplashFont = pygame.font.Font('freesansbold.ttf', 50) ScoreFont = pygame.font.Font('freesansbold.ttf', 34) DescFont = pygame.font.Font('freesansbold.ttf', 44) shotsnd = rs.LoadSound('Shot.ogg') directions = {'UP': 0, 'RIGHT': 1, 'DOWN': 2, 'LEFT': 3} token = '' tonkid = '' screen = '' color = gh.createcol(0) AI = False AIs = { 'GladOS': (200, 200), 'Tomas the dank engine': (500, 100), 'Копатыч': (10000, 1), 'Tonkinator': (240, 140), 'Bender': (300, 140) } tonks = {} bullets = [] scores = {}
import pygame import colorsys import math import random import ResourceLoader as rs import GraphicsHelper as gh bulletimg = rs.LoadImage('bullet.png') shotsnd = rs.LoadSound('Shot.ogg') destroysnd = rs.LoadSound('destroy.ogg') nickfont = pygame.font.Font('freesansbold.ttf', 14) speed = 2.5 bulletspeed = 5 def FindNearest(tks,me): nearest = '' nearestdis = 20000000000000 for tk in tks: if(tk != me.nick): dis = (me.x-tks[tk].x)**2+(me.y-tks[tk].y)**2 if(dis < nearestdis): nearest = tks[tk] nearestdis = dis return nearest def getSqrDistance(pos1,pos2): return (pos1[0]-pos2[0])**2+(pos1[1]-pos2[1])**2
gamestate = 1 buttonfont = pygame.font.Font('freesansbold.ttf', 26) titlefont = pygame.font.Font('freesansbold.ttf', 40) p1col = '' p2col = '' play = True tk1 = '' tk2 = '' powertimer = 0 powerup = None bullets = [] blocks = [] lvl = '' lvlname = '' repairsound = rs.LoadSound('Repair.ogg') brickimg = rs.LoadImage('brick.png') woodimg = rs.LoadImage('wood.png') def intersect(colbox1,colbox2): return(colbox2[0] <= colbox1[0]+colbox1[2] and colbox2[1] <= colbox1[1]+colbox1[3]) and (colbox2[0]+colbox2[2] >= colbox1[0] and colbox2[1]+colbox2[3] >= colbox1[1]) def Menu(): global play play = False def Restart(): global gamestate global tk1