def __init__(self, dataarray, size): S, x, y, r, f, fr, i, t, c = dataarray self.spawn = (S=='*') self.radius = int(r) self.fradius = int(fr) self.force = int(f) self.vPos = vector(int(x),-int(y))+vector(size, size) self.items = i self.period = int(t) self.lastspawn = self.period self.color = tuple(map(int, c.split(',')))
def __init__(self, sprit, vPos=phys.vector(0, 0)): self.phsobj = phys.physobj(20, vPos) self.hp = MAXHP sprite.init(self, sprit) self.gun = None self.ded = 0 # gameloop analyses or respawns depending on this
pygame.display.set_mode((640, 480)) screen = pygame.display.get_surface() pygame.mouse.set_visible(False) pygame.joystick.Joystick(0).init() mse = pygame.image.load("sprites/aim.png").convert() msa = pygame.image.load("sprites/bull.png").convert() mse.set_colorkey((0, 0, 0)) msa.set_colorkey((0, 0, 0)) msr = pygame.image.load("sprites/ret.png").convert() msr.set_colorkey((0, 0, 0)) fonte = pygame.font.SysFont("asdf", 36) y = 480 - fonte.size("wea")[1] t0 = clock() ret = vector() wn = engine.shooter() wn.phsobj.vPos = vector(320, 240) wn.phsobj.maxspeed = 4900 engine.gunlist.append(engine.gun(wn)) wn.gun = engine.gunlist[1] stick = vector() while True: screen.fill((100, 50, 50)) delta = clock() - t0 t0 = clock() for event in pygame.event.get(): if event.type == 12: quit() elif event.type == 7: