Skip to content

Instantly share code, notes, and snippets.

@russplaysguitar
Created July 19, 2011 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russplaysguitar/1091429 to your computer and use it in GitHub Desktop.
Save russplaysguitar/1091429 to your computer and use it in GitHub Desktop.
A bit of code from PyRunner
class block(scroller):
def __init__(self, y):
scroller.__init__(self)
self.side1 = random.randint(20,100)
self.side2 = 20
self.dimensions = random.choice([(self.side1,self.side2),(self.side2,self.side1)])
self.image = pygame.Surface(self.dimensions)
self.rect = self.image.get_rect()
self.y = y
pygame.draw.rect(self.image, (28,55,183), self.rect)
self.rect.right = pygame.display.get_surface().get_width()
self.rect.centery = y
#make sure the block is on the screen
#debug("block with center y of {0:n}".format(self.rect.centery))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment