About | Rules and Guide | Sign In/Create Account | Write a Post
Construction1990’s Internet Montage? No!
Please excuse the site weirdness. Mike is fixing and making things.
Ludum Dare 31 — Coming December 5th-8th 2014!

  • ??? Begins: in 9 days, 17 hours, 0 minutes, 34 seconds
  • October Ends: in 10 days, 17 hours, 12 minutes, 34 seconds
  • Ludum Dare 31 begins: in 45 days, 18 hours, 0 minutes, 34 seconds
  • (FYI: Clock might be off) | Ludum Dare 31: Real World Gatherings (Now Open!)

    [ October Challenge 2014 | Resources | Submit/Edit | View All ]


    Posts Tagged ‘custom’

    I hope you guys are prepared…

    Posted by
    Thursday, April 17th, 2008 6:47 pm

    I just made my first giant clock! I am so ready for Ludum Dare now that I have this incredible custom library at my fingertips:

    import os, pygame, random, math, pgu
    from pygame.locals import *
    clock = pygame.time.Clock()
    pygame.init()
    screen = pygame.display.set_mode((800,480))
    timer = 0
    seconds = 0
    minutes = 0
    timertext = str(minutes) + “:” + str(seconds)
    background = pygame.Surface(screen.get_size())
    background = background.convert()
    background.fill((250, 250, 250))
    font = pygame.font.Font(None, 500)
    text = font.render(timertext, 1, (10, 10, 10))
    background.blit(text,(0,0))
    screen.blit(background, (0,0))

    quit = 0
    while not quit:
    for e in pygame.event.get():
    if e.type is QUIT: quit = 1
    if e.type is KEYDOWN and e.key == K_ESCAPE: quit = 1
    background.fill((250, 250, 250))
    text = font.render(timertext, 1, (10, 10, 10))
    background.blit(text,(0,0))
    screen.blit(background, (0, 0))
    pygame.display.flip()
    clock.tick(60)
    timer = timer + 1
    if timer == 60:
    seconds = seconds + 1
    timer = 0
    if seconds == 60:
    minutes = minutes + 1
    seconds = 0
    if seconds <= 9:
    timertext = str(minutes) + “:” + “0” + str(seconds)
    else:
    timertext = str(minutes) + “:” + str(seconds)


    All posts, images, and comments are owned by their creators.

    [cache: storing page]