import pygame from pygame.locals import * import numpy import sys import os import platform if platform.system() == 'Windows': os.environ['SDL_VIDEODRIVER'] = 'windib' pygame.init() screen = pygame.display.set_mode((640,480)) class Bullet: def __init__(self, pos=(0,0), vel=(0,0)): x,y = pos self.position = numpy.array([float(x),float(y)]) x,y = vel self.velocity = numpy.array([float(x),float(y)]) def update(self): self.position += self.velocity # collide here def draw(self): pygame.draw.circle(screen,(255,0,0), (int(self.position[0]), int(self.position[1])), 3 ) if __name__ == "__main__": bullets = [] pos = (0, 0) for i in xrange ( 10 ): bullets.append ( Bullet ( pos, (i*0.25, 0.5) ) ) clock = pygame.time.Clock() while True: for event in pygame.event.get(): if event.type == QUIT or (event.type==KEYDOWN and event.key==K_ESCAPE): pygame.quit() sys.exit() clock.tick(30) for bullet in bullets: bullet.update() screen.fill( (0,0,0) ) for bullet in bullets: bullet.draw() pygame.display.update()