Created
September 16, 2011 18:38
-
-
Save palexander/1222770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, pygame, random, math | |
from pygame.locals import * | |
if not pygame.font: print 'Warning, fonts disabled' | |
if not pygame.mixer: print 'Warning, sound disabled' | |
pygame.init() | |
swidth = 800 | |
sheight = 600 | |
screen = pygame.display.set_mode((swidth, sheight)) | |
pygame.display.set_caption('Parlar') | |
pygame.mouse.set_visible(0) | |
background = pygame.Surface(screen.get_size()) | |
background = background.convert() | |
background.fill((50, 10, 45)) | |
# if pygame.font: | |
# font = pygame.font.Font(None, 120) | |
# text = font.render("The City", 1, (10, 10, 10)) | |
# textpos = text.get_rect(centerx=background.get_width()/2) | |
# background.blit(text, textpos) | |
win = pygame.Surface((10, 15)) | |
win.fill((255, 255, 255)) | |
background.blit(win, (410, 310)) | |
full_screen = False | |
last_right = 0 | |
while full_screen != True: | |
print("filling screen") | |
bwidth = round(random.randrange(100, 200), -1) | |
bheight = round(random.randrange(200, sheight - 100), -1) | |
print("blding: " + str(bwidth) + ", " + str(bheight)) | |
bld = pygame.Surface((bwidth, bheight)) | |
bld.fill((0, 0, 0)) | |
background.blit(bld, (last_right + 10, sheight - bld.get_height())) | |
last_right = last_right + bwidth + 10 | |
if last_right > swidth: | |
full_screen = True | |
screen.blit(background, (0, 0)) | |
pygame.display.flip() | |
while 1: | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: sys.exit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment