Exemple #1
0
 def __init__(self, name, width, height, map, tilesize, director):
     self.name = name
     self.height = height
     self.width = width
     self.map = map
     self.TILESIZE = tilesize
     self.director = director
     self.camera = camera.Camera(camera.complex_camera, 100 * 32, 100 * 32)
     self.collidables = []
     self.i = (0, 0)
     self.start = False
Exemple #2
0
font = pygame.font.Font(None, 25)
message = text.DynamicText(font, "Xulián Basura...", 0, autoreset=True)
#groupSprites = pygame.sprite.Group(player,enemigo)

groupSprites = pygame.sprite.Group(player)
hitboxGroup = pygame.sprite.Group(player.hitbox)
level = serializer.loadLevel("bigtest.png")

#collidables = [MySprite()] * 100
#for c in collidables:
#    c.image = resourceManager.loadImage("enemy1.png")
#    c.rect = pygame.Rect(random.randrange(0,10)*32,random.randrange(0,10)*32,32,32)
#    print(c.rect)
#level.add_collidables(collidables)

camara = camera.Camera(camera.complex_camera, 100 * 32, 100 * 32)
pygame.key.set_repeat(100)

# Bucle infinito
while True:
    clock.tick(60)
    # Para cada evento posible
    for evento in pygame.event.get():

        # Si el evento es la pulsación de la tecla Escape
        if evento.type == KEYDOWN and evento.key == K_ESCAPE:
            # Se sale del programa
            pygame.quit()
            sys.exit()
        if evento.type == pygame.USEREVENT: message.update()
        if (evento.type == KEYDOWN and evento.key == K_SPACE): message.update()
Exemple #3
0
                                           traversable=True,
                                           map_x=obj_x,
                                           map_y=obj_y,
                                           batch=game_batch,
                                           group=foreground)
            try:
                env_obj_dict.update({(obj.col_x(), obj.col_y()): obj})
            except NameError:
                pass

scale = p.TILE_SIZE / r.tile_imgs[0].width

for tile in tile_objs:
    tile.scale = scale

cam = camera.Camera(game_window, map_obj.width, map_obj.height, game_batch)


def generate_position():
    return randrange(0, map_obj.width), randrange(0, map_obj.height)


ai_characters = []

for _ in range(3 * p.MAP_TILE_SCALE):
    x, y = generate_position()
    ai_characters.append(
        char_air.CharAir(map_x=x, map_y=y, group=foreground, batch=game_batch))
    x, y = generate_position()
    ai_characters.append(
        char_fire.CharFire(map_x=x,
Exemple #4
0
player.updateHitboxPosition()
clock = pygame.time.Clock()
font = pygame.font.Font(None, 25)
#message = text.DynamicText(font, "Xulián Basura...",0, autoreset=True)
diag = diag.Dialog("Test")
#groupSprites = pygame.sprite.Group(player1,enemigo)
level = serializer.loadLevel("bigtest.png")

#collidables = [MySprite()] * 100
#for c in collidables:
#    c.image = resourceManager.loadImage("enemy1.png")
#    c.rect = pygame.Rect(random.randrange(0,10)*32,random.randrange(0,10)*32,32,32)
#    print(c.rect)
#level.add_collidables(collidables)

camara = camera.Camera(camera.simple_camera, 100 * 32, 100 * 32)
pygame.key.set_repeat(100)

# Bucle infinito
diag.queueScreen()
while True:
    clock.tick(60)
    # Para cada evento posible
    for evento in pygame.event.get():

        # Si el evento es la pulsación de la tecla Escape
        if evento.type == KEYDOWN and evento.key == K_ESCAPE:
            # Se sale del programa
            pygame.quit()
            sys.exit()
        if (evento.type == KEYDOWN and evento.key == K_a): diag.queueScreen()