コード例 #1
0
ファイル: physics.py プロジェクト: brettdh/xmaspi-client
		if initial:
			bulbs.render()
			sleep(.1)

print "Starting with %d balls at positions:" % (NUM_BALLS)
for ball,color,direction in balls:
	print "\t%d: %s going %d" % (ball, str(color), direction)
	bulbs.frame[ball] = color
	bulbs.render()
	sleep(.1)
	ghost(ball, color, direction, True)

# Blink balls before starting motion
cache = bulbs.frame
for blinks in range(3):
	bulbs.frame = blank_slate
	bulbs.render(force=True)
	d.busy_wait(.5)
	bulbs.frame = cache
	bulbs.render(force=True)
	d.busy_wait(.5)


def advance(ball_tuple):
	ball, color, direction = ball_tuple
	r,g,b,a = color

	if ball+direction in bumpers:
		print "%d Hit bumper." % (ball)
		direction = -direction
		ball = ball + direction