File: gamewin.py

package info (click to toggle)
solarwolf 1.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,348 kB
  • ctags: 371
  • sloc: python: 2,640; makefile: 56; sh: 31
file content (86 lines) | stat: -rw-r--r-- 1,791 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"gamemenu handler. main menu"

import math, os
import pygame
from pygame.locals import *
import game, gfx, snd
import gameplay



cheer = (
    'Congradulations!',
    'You Beat The Game!',
    ' ',
    'All Your Box Are Belong To Us',
    'Flawless Victory',
    'Ya Headless Freaks',
    'Your Creature Will Eat That More Often',
    'Thou Hast Gained An Eighth',
    'Stay Awhile And Listen',
    'Damn! Those alien dastards are gonna pay for ruining my ride',
    'Dont Shoot! I\'m with the science team',
    'You Spoony Bard', 
    'Quad Damage', 
    ' ', 
    ' ', 
    ' ', 
    '(hey, not like the doom ending was much better)'
)


fonts = []

def load_game_resources():
    global fonts
    fontname = None
    fonts.append(pygame.font.Font(fontname, 30))
    
    snd.preload('select_choose')


class GameWin:
    def __init__(self, prevhandler):
        self.prevhandler = prevhandler
        self.done = 0
        self.top = 50
        self.center = gfx.rect.centerx
        self.text = []
        font = fonts[0]
        for line in cheer:
            img, r = gfx.text(font, (250, 250, 250), line, (self.center, self.top))
            self.top += 30
            self.text.append((img, r))
        

    def quit(self):
        game.handler = self.prevhandler
        self.done = 1
        snd.play('select_choose')


    def input(self, i):
        self.quit()

    def event(self, e):
        pass


    def run(self):
        for cred in self.text:
            r = cred[1]
            self.background(r)
            gfx.dirty(r)

        gfx.updatestars(self.background, gfx)

        if not self.done:
            for cred, pos in self.text:
                gfx.surface.blit(cred, pos)


    def background(self, area):
        return gfx.surface.fill((0, 0, 0), area)