Exemplo n.º 1
0
    def __init__(self):
        super(GameOver, self).__init__(32, 32, 32, 64)
        w, h = cocos.director.director.get_window_size()
        soundex.play('no.mp3')
        msg = 'GAME OVER'
        label = cocos.text.Label(msg,
                                 font_name='Edit Undo Line BRK',
                                 font_size=54,
                                 anchor_y='center',
                                 anchor_x='center')
        label.position = ( w / 2.0, h / 2.0 )
        self.add(label)
        angle = 5
        duration = 0.05
        accel = 2
        rot = Accelerate(Rotate(angle, duration // 2), accel)
        rot2 = Accelerate(Rotate(-angle * 2, duration), accel)
        effect = rot + (rot2 + Reverse(rot2)) * 4 + Reverse(rot)

        label.do(Repeat(Delay(5) + effect))

        if hiscore.hiscore.is_in(state.score):
            self.hi_score = True

            label = cocos.text.Label('Escribe tu nombre:',
                                     font_name='Edit Undo Line BRK',
                                     font_size=36,
                                     anchor_y='center',
                                     anchor_x='center',
                                     color=(32, 32, 32, 255),
            )
            label.position = ( w / 2.0, h / 2.0 )
            label.position = (w // 2, 130)
            self.add(label)

            self.name = cocos.text.Label('',
                                         font_name='Edit Undo Line BRK',
                                         font_size=36,
                                         anchor_y='center',
                                         anchor_x='center',
                                         color=(32, 32, 32, 255),
            )
            self.name.position = (w // 2, 80)
            self.add(self.name)
        else:
            self.hi_score = False
            label = cocos.text.Label("Presione 'R' para jugar otra vez",
                                     font_name='Edit Undo Line BRK',
                                     font_size=18,
                                     anchor_y='center',
                                     anchor_x='center')
            label.position = ( w / 2.0, 20 )
            self.add(label)
Exemplo n.º 2
0
 def desmontar(self):
     self.animations['right_walking'] = self.animations['right_walking_human']
     self.animations['right_landing'] = self.animations['right_landing_human']
     self.velocity /= 1.2
     self.dog = False
     soundex.play('ladrido.wav')
Exemplo n.º 3
0
 def montar(self):
     self.animations['right_walking'] = self.animations['right_walking_dog']
     self.animations['right_landing'] = self.animations['right_landing_dog']
     self.velocity *= 1.2
     self.dog = True
     soundex.play('ladrido.wav')