All pastes #715116 Raw Edit

Miscellany

public python v1 · immutable
#715116 ·published 2007-09-26 01:23 UTC
rendered paste body
paddleWidth = 40 # Width of paddle fo' collision detection.paddleHeight = 10 # Height of the paddle.paddleY = 255 # Y position of paddle from the top.paddleX = 0 # X position of the leftmost point on the paddle.ballX,ballY = 0,0 # X and Y position of the 'ball'lor = "null" # Left or right or up. Direction for the ball to go after bouncing. Will be null if ball passed straight throughif ballX < 2 or ballY < 2: # Uh oh, ball is on a wall. Now we gotta check if it's on the bottom one..	if ballY > paddleY:		# UH OH! BALL IS UNDERNEATH PADDLE, MEANING ITS DEAD!!!!!!!111oneoneone!11!	else:		# Ball has just hit a wall.else:	if ballY == paddleY and ballX >= paddleX and ballX <= paddleX + paddleWidth:		if ballX < paddleX+paddleWidth/2:			lor = "left"		else:			if ballX > paddleX + paddleWidth/2:				lor = "right"			else:				lor = "up"