bullet = pygame.Surface([3, 3])
bullet.fill([255, 0, 0])
filename = argv[0]
- doc = bulletml.BulletML(open(filename, "rU"))
clock = pygame.time.Clock()
target = bulletml.Bullet()
+ file_idx = 0
+
+ if not argv:
+ raise SystemExit
+
while True:
+ doc = bulletml.BulletML(open(argv[file_idx % len(argv)], "rU"))
source = bulletml.Bullet.FromDoc(
doc, x=150, y=150, target=target, rank=0.5)
frames = 0
total = 0
paused = False
+ newfile = False
- while active:
+ while active and not newfile:
go = False
for event in pygame.event.get():
paused ^= True
elif event.key == pygame.K_RIGHT:
go = True
+ elif event.key == pygame.K_PAGEUP:
+ file_idx -= 1
+ newfile = True
+ elif event.key == pygame.K_PAGEDOWN:
+ file_idx += 1
+ newfile = True
+ elif event.key == pygame.K_RETURN:
+ newfile = True
target.x, target.y = pygame.mouse.get_pos()
target.x /= 2
- target.y = (screen.get_height() - target.y) / 2
+ target.y /= 2
if not paused or go:
y *= 2
x -= 1
y -= 1
- screen.blit(bullet, [x, screen.get_height() - y])
+ screen.blit(bullet, [x, y])
pygame.display.flip()
clock.tick(60)