def f(position, direction, momentum, shotgroup): for i in floatrange(spread, -1 * spread, numshots): if abs(i) > 0.0001: theta = abs(abs(i) - pi / 2) d = direction + i radius = dist / (2 * cos(theta)) period = ctime * (2 * pi) / (pi - 2 * theta) if abs(i) > pi / 2: period = ctime * (2 * pi) / (pi + 2 * theta) cc = COUNTERCLOCKWISE if i < 0: cc = CLOCKWISE sheading = momentum route = loop(radius, period, d, cc) + advance() else: route = advance() sheading = momentum + vectorfromangle(direction).mult(300.0/ctime) size = 1 lifetime = ctime * 2 s = Shot(position=position, heading=sheading, image=image, size=size, route=route, lifetime=lifetime, payload=payload) shotgroup.add(s)
def f(position, direction, momentum, shotgroup): for i in floatrange(width, width * -1, numshots): z = vectorfromangle(direction + pi /2, i) p = position + z sheading = vectorfromangle(direction, speed) + momentum size = 1 if i > 0: c = COUNTERCLOCKWISE else: c = CLOCKWISE route = loop(abs(i), period, direction, c) + advance() s = Shot(position=p, heading=sheading, image=image, size=size, route=route, payload=payload) shotgroup.add(s)