Esempio n. 1
0
 def __init__(self, x, y, screen):
     super().__init__(x, y, screen)
     self.light = pygame.sprite.Sprite()
     self.light_group = pygame.sprite.Group()
     self.light.image = pygame.image.load(
         path_func.resource_path(
             path_func.resource_path("res_red_door.png")))
     self.light.rect = self.light.image.get_rect()
     self.light_group.add(self.light)
     self.width, self.height = self.light.rect.size
     self.rect = self.light.rect
     self.string = 'light'
Esempio n. 2
0
 def __init__(self, x, y, screen):
     super().__init__(x, y, screen)
     self.dplayer = pygame.sprite.Sprite()
     self.dplayer_group = pygame.sprite.Group()
     self.dplayer.image = pygame.image.load(path_func.resource_path("res_die.png"))
     self.dplayer.rect = self.dplayer.image.get_rect()
     self.dplayer_group.add(self.dplayer)
     self.width, self.height = self.dplayer.rect.size
     self.rect = self.dplayer.rect
     self.string = 'die player'
Esempio n. 3
0
 def __init__(self, x, y, screen):
     super().__init__(x, y, screen)
     self.gbutton = pygame.sprite.Sprite()
     self.gbutton_group = pygame.sprite.Group()
     self.gbutton.image = pygame.image.load(
         path_func.resource_path("res_green_button.png"))
     self.gbutton.rect = self.gbutton.image.get_rect()
     self.gbutton_group.add(self.gbutton)
     self.width, self.height = self.gbutton.rect.size
     self.rect = self.gbutton.rect
     self.string = 'green button'
Esempio n. 4
0
 def __init__(self, x, y, screen):
     super().__init__(x, y, screen)
     self.life = pygame.sprite.Sprite()
     self.life_group = pygame.sprite.Group()
     self.life.image = pygame.image.load(
         path_func.resource_path("res_life.png"))
     self.life.rect = self.life.image.get_rect()
     self.life_group.add(self.life)
     self.width, self.height = self.life.rect.size
     self.rect = self.life.rect
     self.reserv_x = self.x
     self.reserv_y = self.y
     self.string = 'life'
Esempio n. 5
0
 def __init__(self, x, y, screen):
     super().__init__(x, y, screen)
     self.sblock = pygame.sprite.Sprite()
     self.sblock_group = pygame.sprite.Group()
     self.reserv_x = self.x
     self.reserv_y = self.y
     self.counter = 0
     self.sblock.image = pygame.image.load(
         path_func.resource_path("res_shadow_block.png"))
     self.sblock.rect = self.sblock.image.get_rect()
     self.sblock_group.add(self.sblock)
     self.width, self.height = self.sblock.rect.size
     self.rect = self.sblock.rect
     self.string = 'shadow block'
Esempio n. 6
0
 def __init__(self, x, y, screen):
     super().__init__(x, y, screen)
     self.speed = 240
     self.player = pygame.sprite.Sprite()
     self.player_group = pygame.sprite.Group()
     self.player.image = pygame.image.load(path_func.resource_path('res_unit.png'))
     self.player.rect = self.player.image.get_rect()
     self.player_group.add(self.player)
     self.height = self.player.rect.height
     self.width = self.player.rect.width
     self.rect = self.player.rect
     self.string = 'player'
     self.counter = 0
     self.reserv_x = 0
     self.reserv_y = 0
Esempio n. 7
0
        self.phys.stop()


if __name__ == '__main__':
    size = width, height = 1500, 980
    screen = pygame.display.set_mode(size)
    running = True
    fps = 60
    counter = 30
    pygame.init()
    pygame.display.set_caption('30 seconds to escape')
    text = '30'.rjust(3)
    font = pygame.font.SysFont('serif', 60)
    pygame.time.set_timer(pygame.USEREVENT, 1000)
    background = pygame.image.load(
        path_func.resource_path("back.png")).convert()
    win = pygame.image.load(path_func.resource_path("you_win.png")).convert()
    ma = Game(screen, fps)
    clock = pygame.time.Clock()
    while running:
        for event in pygame.event.get():
            if event.type == pygame.USEREVENT:
                counter -= 1
                text = str(counter).rjust(3)
                if counter == 0 and not ma.win:
                    ma.game_over = True
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_LEFT:
                    ma.go_left()
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_RIGHT: