Skip to content
This repository
Browse code

Fixed Button class and intro loop.

  • Loading branch information...
commit 2f4b310c12ccaa1022843cb999f68da4e5521f5a 1 parent 902200d
Mike McConnell authored March 21, 2013
56  classes/button.py
@@ -3,20 +3,22 @@
3 3
 import random, pygame, sys
4 4
 from pygame.locals import *
5 5
 from const import *
  6
+import methods
6 7
 
7 8
 
8 9
 class Button():
9 10
     """
10 11
     A clickable button that is rendered on screen.
11 12
     """
12  
-    def __init__(self, text, (x, y), key=None): # (x,y)
13  
-        self.text = text # (str)
  13
+    def __init__(self, text, (x, y), key=None):
  14
+        self.text = str(text)
14 15
         size = int (WINDOWWIDTH / 18)
15 16
         self.font = pygame.font.Font('freesansbold.ttf', size) # FONT default?
16 17
         self.startSurf = self.font.render(self.text, True, BUTTONCOLOR, BUTTONTEXT) # Refactor BUTTONCOLOR BUTTONTEXT -- must surf be self.?
17 18
         self.rect = self.startSurf.get_rect()
18 19
         self.rect.center = x,y
19 20
         self.key = key
  21
+        self.game = None
20 22
 
21 23
     def display(self):
22 24
         DISPLAYSURF.blit(self.startSurf, self.rect)
@@ -29,7 +31,57 @@ def pressed(self, mouse): # return conditions
29 31
     
30 32
     def keypressed(self, key):
31 33
         return key == self.key
  34
+    
  35
+
  36
+class DuelButton(Button):
  37
+    """ Includes getplayers() method; choice on screen. """
  38
+    def __init__(self, text, (x, y), key=None):
  39
+        Button.__init__(self, text, (x, y), key)
  40
+        
  41
+    def getplayers(self):
  42
+        return methods.showSelectPlayersScreen()
  43
+
  44
+
  45
+class PartyButton(Button):
  46
+    """ Includes getplayers(); randomly adds players. """
  47
+    def __init__(self, text, (x, y), key=None):
  48
+        Button.__init__(self, text, (x, y), key)
  49
+        self.numplayers = 4
  50
+        
  51
+    def getplayers(self):
  52
+        """ Generates and returns list of players, numplayers long.
  53
+            First position is always SNAKEY. """
  54
+        players = [SNAKEY]
  55
+        while len(players) < self.numplayers:
  56
+            r = random.randint(1,3)
  57
+            if r == 1:
  58
+                players.append(LINUS)
  59
+            elif r == 2:
  60
+                players.append(WIGGLES)
  61
+            else:
  62
+                players.append(GOOBER)
  63
+        return players
  64
+    
  65
+
  66
+class InstructButton(Button):
  67
+    """ Shows instructions. """
  68
+    def __init__(self, text, (x, y), key=None):
  69
+        Button.__init__(self, text, (x, y), key)
  70
+        
  71
+    def showinstructions(self):
  72
+        methods.showInstructScreen()
  73
+        
  74
+        
  75
+class SandboxButton(Button, PartyButton):
  76
+    """ Includes getplayers() and getgame(). """
  77
+    def __init__(self, text, (x, y), key=None):
  78
+        PartyButton.__init__(self, text, (x, y), key)
32 79
         
  80
+    def getgame(self):
  81
+        """ Brings up selection screen; returns tupe containing
  82
+            Game object and snakes. """
  83
+        self.game = methods.showSandboxScreen() # will not work for now
  84
+        return (self.game, self.getplayers())
33 85
 
34 86
 
35 87
 class SelectButton(Button):
286  classes/game.py
... ...
@@ -0,0 +1,286 @@
  1
+#!/usr/bin/env python
  2
+
  3
+import random, pygame, sys
  4
+from pygame.locals import *
  5
+from const import *
  6
+from methods import *
  7
+from fruit import *
  8
+
  9
+
  10
+class Game:
  11
+    """
  12
+    Responsible for dynamics for a particular game instance.
  13
+    fruitEaten - a dictionary containing a numeric tally of each fruit eaten.
  14
+    speedTrigger - the frequency (based on apples consumed) in which gamespeed is increased by one.
  15
+    bonusFruitTrigger - the frequency (based on apples consumed) in which a bonus game is launched.
  16
+    easyTrigger - a threshold (apples consumed); once reached fruit can be placed anywhere on screen (as opposed to away from edges).
  17
+    currentplace - the current 'place' of snake. When snake has died.
  18
+    apples - number of apples on screen.
  19
+    """
  20
+    def __init__(self, **kwargs):
  21
+        # defaults
  22
+        self.fruitEaten = {'apple':0, 'poison':0, 'orange':0, 'raspberry':0,
  23
+                           'blueberry':0, 'lemon':0, 'egg':0}
  24
+        self.speedTrigger = kwargs.get('speedTrigger', 20)
  25
+        self.bonusFruitTrigger = kwargs.get('bonusFruitTrigger', 10)
  26
+        self.easyTrigger = kwargs.get('easyTrigger', 20)
  27
+        self.currentplace = 1
  28
+        self.apples = kwargs.get('apples', 1)
  29
+        self.basespeed = kwargs.get('basespeed', FPS)
  30
+        self.currentspeed = self.basespeed
  31
+        self.slowtimer = 0
  32
+        self.trailing = kwargs.get('trailing', False)
  33
+        self.poisonDrop = kwargs.get('poisonDrop', 4)
  34
+        self.orangeDrop = kwargs.get('orangeDrop', 5)
  35
+        self.raspberryDrop = kwargs.get('raspberryDrop', 6)
  36
+        self.blueberryDrop = kwargs.get('blueberryDrop', 25)
  37
+        self.lemonDrop = kwargs.get('lemonDrop', 100)
  38
+        self.eggDrop = kwargs.get('eggDrop', 20)
  39
+
  40
+
  41
+    def checkSpeedTrigger(self):
  42
+        """
  43
+        Returns true if number of apples consumed modulo speedTrigger equals zero.
  44
+        """
  45
+        if self.fruitEaten['apple'] % self.speedTrigger == 0:
  46
+            return True
  47
+        else:
  48
+            return False
  49
+
  50
+    def checkBonusTrigger(self):
  51
+        """
  52
+        Returns true if number of apples consumed modulo bonusTrigger equals zero.
  53
+        """
  54
+        if self.fruitEaten['apple'] % self.bonusFruitTrigger == 0:
  55
+            return True
  56
+        else:
  57
+            return False
  58
+
  59
+    def checkEasyTrigger(self):
  60
+        """
  61
+        Returns true if number of apples consumed is less than or equal to easyTrigger.
  62
+        """
  63
+        if self.fruitEaten['apple'] <= self.easyTrigger:
  64
+            return True
  65
+        else:
  66
+            return False
  67
+            
  68
+    def checkSnakeDeath(self, allsnake):
  69
+        """
  70
+        Returns true if there are no more living snakes.
  71
+        Sets place of snake if recently died.
  72
+        """
  73
+        gameover = True
  74
+        for snake in allsnake:
  75
+            if snake.scored == True:
  76
+                if snake.alive == True:
  77
+                    gameover = False
  78
+                elif snake.place == False:
  79
+                    snake.place = self.currentplace
  80
+                    self.currentplace = self.currentplace + 1
  81
+        return gameover
  82
+        
  83
+    def updateBaseSpeed(self, value):
  84
+        """
  85
+        Updates basespeed by value inputted.
  86
+        Checks against parameters
  87
+        """
  88
+        if (self.basespeed + value > MIN_FPS) and \
  89
+           (self.basespeed + value < MAX_FPS):
  90
+            self.basespeed = self.basespeed + value
  91
+            self.currentspeed = self.basespeed
  92
+            
  93
+    def updateCurrentSpeed(self, goal=False, force=False):
  94
+        """
  95
+        Adjusts currentspeed one towards goal.
  96
+        Goal defaults to basespeed.
  97
+        Optional 'force' will set currentspeed to goal instead.
  98
+        """
  99
+        if goal == False:
  100
+            goal = self.basespeed
  101
+            
  102
+        if force != False:
  103
+            self.currentspeed = goal
  104
+        else:
  105
+            if self.currentspeed < goal:
  106
+                self.currentspeed = self.currentspeed + 1
  107
+            elif self.currentspeed > goal:
  108
+                self.currentspeed = self.currentspeed - 1
  109
+
  110
+    def checkSlowTimer(self):
  111
+        """
  112
+        Returns true if slowtimer is greater than 0.
  113
+        """
  114
+        if self.slowtimer > 0:
  115
+            return True
  116
+        else:
  117
+            return False
  118
+
  119
+    def updateSlowTimer(self):
  120
+        """
  121
+        Decrements slowtimer by one
  122
+        """
  123
+        self.slowtimer = self.slowtimer - 1
  124
+        
  125
+    def runDrop(self, allfruit, allsnake):
  126
+        """
  127
+        Adds fruit randomly to screen.
  128
+        If newapple is turned on, replaces apple that was eaten.
  129
+        """
  130
+        # chance of poison drop
  131
+        if self.poisonDrop != False and random.randint(1,self.poisonDrop) == 1:
  132
+            p = Poison(allfruit, allsnake, self)
  133
+            allfruit.append(p)
  134
+        # chance of orange drop
  135
+        if self.orangeDrop != False and random.randint(1,self.orangeDrop) == 1:
  136
+            o = Orange(allfruit, allsnake, self)
  137
+            allfruit.append(o)
  138
+        # chance of raspberry drop
  139
+        if self.raspberryDrop != False and random.randint(1,self.raspberryDrop) == 1:
  140
+            r = Raspberry(allfruit, allsnake, self)
  141
+            allfruit.append(r)
  142
+        # chance of blueberry drop
  143
+        if self.blueberryDrop != False and random.randint(1,self.blueberryDrop) == 1:
  144
+            b = Blueberry(allfruit, allsnake, self)
  145
+            allfruit.append(b)
  146
+        # chance of lemon drop
  147
+        if self.lemonDrop != False and random.randint(1,self.lemonDrop) == 1:
  148
+            l = Lemon(allfruit, allsnake, self)
  149
+            allfruit.append(l)
  150
+        # chance of egg drop
  151
+        if self.eggDrop != False and random.randint(1,self.eggDrop) == 1:
  152
+            e = Egg(allfruit, allsnake, self)
  153
+            allfruit.append(e)
  154
+        # create new apple
  155
+        a = Apple(allfruit, allsnake, self)
  156
+        allfruit.append(a)
  157
+
  158
+    def runBonusFruit(self, allfruit, allsnake):
  159
+        """
  160
+        Returns a list containing fruit (as strings) to be added to game from bonus game.
  161
+        An integer (determined randomly between typeMin and typeMax) corresponds to bonus game run.
  162
+        A basic set-up would randomly choose between 1 and 10; 6 through 10 initiating a fruit specific bonus.
  163
+        Default will contain an assortment of fruit.
  164
+        """
  165
+        bonus = []
  166
+        type = random.randint(1, 20)
  167
+        
  168
+        # drop amounts based on size of playing field
  169
+        squares = CELLWIDTH * CELLHEIGHT
  170
+        tinyLower = int(squares / 600)
  171
+        tinyUpper = int(squares / 135)
  172
+        smallLower = int(squares / 68)
  173
+        smallUpper = int(squares / 45)
  174
+        largeLower = int(squares / 34)
  175
+        largeUpper = int(squares / 19)
  176
+        
  177
+        # based on bonus type, create fruits
  178
+        if type == 1:
  179
+            counter = random.randint(smallLower,smallUpper)
  180
+            while counter > 0:
  181
+                bonus.append('egg')
  182
+                counter = counter - 1
  183
+        elif type == 2 or type == 3:
  184
+            counter = random.randint(largeLower,largeUpper)
  185
+            while counter > 0:
  186
+                bonus.append('poison')
  187
+                counter = counter - 1
  188
+        elif type == 4 or type == 5:
  189
+            counter = random.randint(largeLower,largeUpper)
  190
+            while counter > 0:
  191
+                bonus.append('orange')
  192
+                counter = counter - 1
  193
+        elif type == 6:
  194
+            counter = random.randint(largeLower,largeUpper)
  195
+            while counter > 0:
  196
+                bonus.append('raspberry')
  197
+                counter = counter - 1
  198
+        elif type == 7:
  199
+            counter = random.randint(largeLower,largeUpper)
  200
+            while counter > 0:
  201
+                bonus.append('blueberry')
  202
+                counter = counter - 1
  203
+        # default bonus
  204
+        else:
  205
+            counter = random.randint(tinyLower, tinyUpper)
  206
+            while counter > 0:
  207
+                bonus.append('poison')
  208
+                counter = counter - 1
  209
+            counter = random.randint(5,20)
  210
+            while counter > 0:
  211
+                bonus.append('orange')
  212
+                counter = counter - 1
  213
+            counter = random.randint(tinyLower, tinyUpper)
  214
+            while counter > 0:
  215
+                bonus.append('raspberry')
  216
+                counter = counter - 1
  217
+            counter = random.randint(tinyLower, tinyUpper)
  218
+            while counter > 0:
  219
+                bonus.append('blueberry')
  220
+                counter = counter - 1
  221
+        
  222
+        # add fruits
  223
+        for bonusfruit in bonus:
  224
+            if bonusfruit == 'poison':
  225
+                f = Poison(allfruit, allsnake, self)
  226
+            elif bonusfruit == 'orange':
  227
+                f = Orange(allfruit, allsnake, self)
  228
+            elif bonusfruit == 'raspberry':
  229
+                f = Raspberry(allfruit, allsnake, self)
  230
+            elif bonusfruit == 'blueberry':
  231
+                f = Blueberry(allfruit, allsnake, self)
  232
+            elif bonusfruit == 'lemon':
  233
+                f = Lemon(allfruit, allsnake, self)
  234
+            elif bonusfruit == 'egg':
  235
+                f = Egg(allfruit, allsnake, self)
  236
+            allfruit.append(f)
  237
+            
  238
+    def drawScreen(self, allfruit, allsnake, player):
  239
+        """
  240
+        Responsible for drawing everything onto screen.
  241
+        """
  242
+        # clear background
  243
+        DISPLAYSURF.fill(BACKGROUNDCOLOR)
  244
+
  245
+        # check slow and adjust fps as needed
  246
+        # draw grid to screen as well (color based on slow or normal)
  247
+        if self.checkSlowTimer():
  248
+            self.updateSlowTimer()
  249
+            self.updateCurrentSpeed(FREEZING_POINT)
  250
+            self.drawGrid(DARKBLUE)
  251
+        else:
  252
+            self.updateCurrentSpeed()
  253
+            self.drawGrid()
  254
+
  255
+        # draw everything else to screen
  256
+        for fruit in allfruit:
  257
+            fruit.drawFruit()
  258
+        for snake in allsnake:
  259
+            snake.drawSnake()
  260
+            
  261
+        # print scores only if snake is scored
  262
+        position = 1
  263
+        for snake in allsnake:
  264
+            if snake.scored == True:
  265
+                snake.drawScore(position, allsnake)
  266
+                position = position + 1
  267
+
  268
+        # if player is dead, print extra messages
  269
+        if player == False or player.alive == False:
  270
+            endMessage = 'press (e) to end game early'
  271
+            fastMessage = 'press (f) to fast-forward game'
  272
+            slowMessage = 'press (s) to slow game'
  273
+            drawMessage(endMessage, WINDOWWIDTH / 2, WINDOWHEIGHT / 20 * 16)
  274
+            drawMessage(fastMessage, WINDOWWIDTH / 2, WINDOWHEIGHT / 20 * 17)
  275
+            drawMessage(slowMessage, WINDOWWIDTH / 2, WINDOWHEIGHT / 20 * 18)
  276
+        pygame.display.update()
  277
+        FPSCLOCK.tick(self.currentspeed)
  278
+        
  279
+    def drawGrid(self, color=DARKGRAY):
  280
+        """
  281
+        Draws grid to screen.
  282
+        """
  283
+        for x in range(0, WINDOWWIDTH, CELLSIZE): # draw vertical lines
  284
+            pygame.draw.line(DISPLAYSURF, color, (x, TOP_BUFFER), (x, WINDOWHEIGHT))
  285
+        for y in range(TOP_BUFFER, WINDOWHEIGHT, CELLSIZE): # draw horizontal lines
  286
+            pygame.draw.line(DISPLAYSURF, color, (0, y), (WINDOWWIDTH, y))
157  snakey_party.py
@@ -5,7 +5,7 @@
5 5
 # snake size, and other in-game effects.
6 6
 # Includes various Snake AIs and game modes (Arcade, Duel, Party).
7 7
 
8  
-import random, pygame, sys
  8
+import copy, random, pygame, sys
9 9
 from pygame.locals import *
10 10
 from classes.const import *
11 11
 from classes.methods import *
@@ -13,6 +13,7 @@
13 13
 from classes.snake import *
14 14
 from classes.fruit import *
15 15
 from classes.gamedata import *
  16
+from classes.game import Game
16 17
             
17 18
 
18 19
 def main():
@@ -22,99 +23,87 @@ def main():
22 23
     #FPSCLOCK = pygame.time.Clock()
23 24
     #DISPLAYSURF = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
24 25
     pygame.display.set_caption('Snakey Party')
  26
+    col_header = WINDOWWIDTH * 1/2
  27
+    col_one = WINDOWWIDTH * 1/3
  28
+    col_two = WINDOWWIDTH * 2/3
  29
+    row_header = WINDOWHEIGHT * 1/8
  30
+    row_one = WINDOWHEIGHT * 3/8
  31
+    row_two = WINDOWHEIGHT * 4/8
  32
+    row_three = WINDOWHEIGHT * 5/8
  33
+    row_four = WINDOWHEIGHT * 6/8
  34
+    row_five = WINDOWHEIGHT * 7/8
  35
+    buttonlist = []
  36
+    
  37
+    # classic mode
  38
+    cbutton = Button('(c)lassic mode', (col_one, row_one), K_c)
  39
+    cbutton.game = Game()
  40
+    buttonlist.append(cbutton)
  41
+    # arcade mode
  42
+    abutton = Button('(a)rcade mode', (col_one, row_two), K_a)
  43
+    abutton.game = Game(apples=20)
  44
+    buttonlist.append(abutton)
  45
+    # duel mode
  46
+    dbutton = DuelButton('(d)uel mode', (col_one, row_three), K_d)
  47
+    dbutton.game = Game(apples=2, eggDrop=12, speedTrigger=10, easyTrigger=9)
  48
+    buttonlist.append(dbutton)
  49
+    # fast duel mode
  50
+    fbutton = DuelButton('(f)ast duel', (col_one, row_four), K_f)
  51
+    fbutton.game = Game(apples=2, speedTrigger=10, easyTrigger=19, basespeed=20, bonusFruitTrigger=7, eggDrop=10, orangeDrop=4)
  52
+    buttonlist.append(fbutton)
  53
+    # party mode
  54
+    pbutton = PartyButton('(p)arty mode', (col_one, row_five), K_p)
  55
+    pbutton.game = Game(apples=4, speedTrigger=25, easyTrigger=0, bonusFruitTrigger=12)
  56
+    buttonlist.append(pbutton)
  57
+    # tron mode
  58
+    tbutton = PartyButton('(t)ron mode', (col_two, row_one), K_t)
  59
+    tbutton.game = Game(trailing=True)
  60
+    buttonlist.append(tbutton)
  61
+    # TBD
  62
+    # (col_two, row_two)
  63
+    #
  64
+    # sandbox mode
  65
+    sbutton = SandboxButton('(s)andbox mode', (col_two, row_three), K_s)
  66
+    buttonlist.append(sbutton)
  67
+    # instructions
  68
+    ibutton = InstructButton('(i)nstructions', (col_two, row_four), K_i)
  69
+    buttonlist.append(ibutton)
25 70
 
26  
-    arcadebutton = Button('(a)rcade mode', (WINDOWWIDTH / 2, WINDOWHEIGHT * 2/8), K_a) # use range? should be a list of some sort.
27  
-    duelbutton = Button('(d)uel mode', (WINDOWWIDTH / 2, WINDOWHEIGHT * 3/8))
28  
-    partybutton = Button('(p)arty mode', (WINDOWWIDTH / 2, WINDOWHEIGHT * 4/8))
29  
-    tronybutton = Button('(t)ron-y mode', (WINDOWWIDTH / 2, WINDOWHEIGHT * 5/8))
30  
-    sandboxbutton = Button('(s)andbox mode', (WINDOWWIDTH / 2, WINDOWHEIGHT * 6/8))
31  
-    instructbutton = Button('(i)nstructions', (WINDOWWIDTH / 2, WINDOWHEIGHT * 7/8))
32  
-
33  
-    while True: ### need to update this
34  
-
  71
+    
  72
+    while True:
35 73
         DISPLAYSURF.fill(BACKGROUNDCOLOR)
36  
-        drawTitle('Snakey Party', WINDOWWIDTH / 2, WINDOWHEIGHT * 1/8, XLARGETITLE, GREEN, True)
37  
-        arcadebutton.display()
38  
-        duelbutton.display()
39  
-        partybutton.display()
40  
-        tronybutton.display()
41  
-        sandboxbutton.display()
42  
-        instructbutton.display()
43  
-
  74
+        drawTitle('Snakey Party', col_header, row_header, XLARGETITLE, GREEN, True)
  75
+        for button in buttonlist:
  76
+            button.display()
  77
+            
44 78
         for event in pygame.event.get():
45 79
             if event.type == QUIT:
46 80
                 terminate()
47  
-            elif event.type == MOUSEBUTTONDOWN:
48  
-                mouse = pygame.mouse.get_pos()
49  
-                if arcadebutton.pressed(mouse):
50  
-                    pygame.event.get()
51  
-                    game = GameData()
52  
-                    runGame(game, [SNAKEY])
53  
-                    showGameOverScreen()
54  
-                elif duelbutton.pressed(mouse):
55  
-                    pygame.event.get()
56  
-                    players = False
57  
-                    players = showSelectPlayersScreen()
58  
-                    if players != False:
59  
-                        game = GameData(10, 10, 9, 2)
60  
-                        runGame(game, players)
  81
+            elif (event.type == KEYDOWN and event.key == K_ESCAPE):
  82
+                terminate()
  83
+            for button in buttonlist:
  84
+                if (event.type == MOUSEBUTTONDOWN and button.pressed(pygame.mouse.get_pos())) or \
  85
+                    (event.type == KEYDOWN and button.keypressed(event.key)):
  86
+                    if button.game:
  87
+                        game = copy.copy(button.game)
  88
+                        # get players involved
  89
+                        if hasattr(button, 'getplayers'):
  90
+                            players = button.getplayers()
  91
+                        else:
  92
+                            players = [SNAKEY]
  93
+                        rungame(game, players)
61 94
                         showGameOverScreen()
62  
-                elif partybutton.pressed(mouse):
63  
-                    pygame.event.get()
64  
-                    game = GameData(25, 12, 0, 4)
65  
-                    players = getPlayers()
66  
-                    runGame(game, players)
67  
-                    showGameOverScreen()
68  
-                elif tronybutton.pressed(mouse):
69  
-                    pygame.event.get()
70  
-                    game = GameData(25, 12, 0, 0)
71  
-                    game.trailing = True
72  
-                    runGame(game, [SNAKEY, LINUS, WIGGLES, GOOBER])
73  
-                    showGameOverScreen()
74  
-                elif sandboxbutton.pressed(mouse):
75  
-                    showSandboxScreen()
76  
-                elif instructbutton.pressed(mouse):
77  
-                    showInstructScreen()
78  
-            elif event.type == KEYDOWN:
79  
-                #if event.key == K_a:
80  
-                if arcadebutton.keypressed(event.key):
81  
-                    pygame.event.get()
82  
-                    game = GameData()
83  
-                    runGame(game, [SNAKEY])
84  
-                    showGameOverScreen()
85  
-                elif event.key == K_d:
86  
-                    pygame.event.get()
87  
-                    players = False
88  
-                    players = showSelectPlayersScreen()
89  
-                    if players != False:
90  
-                        game = GameData(10, 10, 9, 2)
91  
-                        runGame(game, players)
  95
+                    elif hasattr(button, 'getgame'):
  96
+                        game, players = button.getgame()
  97
+                        rungame(game, players)
92 98
                         showGameOverScreen()
93  
-                elif event.key == K_p:
94  
-                    pygame.event.get()
95  
-                    game = GameData(25, 12, 0, 4)
96  
-                    players = getPlayers()
97  
-                    runGame(game, players)
98  
-                    showGameOverScreen()
99  
-                elif event.key == K_t:
100  
-                    pygame.event.get()
101  
-                    game = GameData(25, 12, 0, 0)
102  
-                    game.trailing = True
103  
-                    runGame(game, [SNAKEY, LINUS, WIGGLES, GOOBER])
104  
-                    showGameOverScreen()
105  
-                elif event.key == K_s:
106  
-                    showSandboxScreen()
107  
-                elif event.key == K_i:
108  
-                    showInstructScreen()
109  
-                elif event.key == K_ESCAPE or event.key == K_q:
110  
-                    terminate()
111  
-
112  
-        game = False
  99
+                    elif hasattr(button, 'showinstruct'):
  100
+                        button.showinstruct()
  101
+        
113 102
         pygame.display.update()
114 103
         FPSCLOCK.tick(FPS)
115  
-        
116 104
 
117  
-def runGame(game, players=[]):
  105
+
  106
+def rungame(game, players=[]):
118 107
 
119 108
     # in game variables
120 109
     allsnake = []

0 notes on commit 2f4b310

Please sign in to comment.
Something went wrong with that request. Please try again.