Mercurial > pygame-tutorial-slides
changeset 175:128f7026ef33
created
| author | 127.0.0.1 |
|---|---|
| date | Mon, 02 Jul 2012 22:37:42 +0200 |
| parents | 0f4b45811ef1 |
| children | a113b3047f9a |
| files | docs/004%2F004%2Fintro.py |
| diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/004%2F004%2Fintro.py Mon Jul 02 22:37:42 2012 +0200 @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +import pygame +import pygame.locals as pg + +import resources +import game + + +class Intro(object): + def __init__(self): + self.screen = pygame.display.get_surface() + self.screen.fill((0x66, 0x66, 0x66)) + self.background = pygame.image.load( + resources.file_path('intro.png')).convert() + + def run(self, scenes): + self.screen.blit(self.background, (0, 0)) + pygame.display.update() + while True: + event = pygame.event.wait() + if event.type == pg.QUIT: + return + elif event.type == pg.KEYDOWN: + scene = game.Game() + scene.load_level('level.tmx') + scenes.append(self) + scenes.append(scene) + return
