Source

pygamegsoc12 / alchemymadness / main.py

import pygame
from pygame.locals import *

import resources
import potion

SCREEN_SIZE = (800, 600)


def main():
    """ your app starts here
    """

    pygame.init()
    screen = pygame.display.set_mode(SCREEN_SIZE)
    clock = pygame.time.Clock()
    going = True
    
    resources.init()

    screen.fill((0,0,0))

    screen.blit(resources.background, (0,0))
    pygame.display.flip()

    # Initialise level
    pot = potion.Potion()
    pot.set_formula(3, 5, 3)
    sprites = pygame.sprite.RenderUpdates(pot)

    #TEST
    pot.add_color((0,0,255))

    while going:
        time = clock.tick(30)

        events = pygame.event.get()
        for e in events:
            if e.type == KEYDOWN and e.key == K_SPACE:
                pot.add_color((255,0,0))
            if e.type == QUIT or e.type == KEYDOWN and e.key == K_ESCAPE:
                going = False

        # Update sprites
        sprites.clear(screen, resources.background)
        sprites.update(time)
        
        # Draw sprites
        rects = sprites.draw(screen)
        pygame.display.update(rects)
        

    # End game
    score = pot.get_score()

    pygame.quit()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.