diff --git a/code/data.py b/code/data.py index 9736a0a..5dda560 100644 --- a/code/data.py +++ b/code/data.py @@ -1,33 +1,36 @@ -WIDTH = 1280 -HEIGTH = 720 +from csv import reader +from os import walk +import pygame + +# ОСНОВНЫЕ НАСТРОЙКИ +WIDTH = 1920 +HEIGTH = 1080 FPS = 60 TILESIZE = 64 +HITBOX = {'player': -26, 'stone': -10, 'invisible': 0} -p1, p2 = 50, 52 -WORLD_MAP = [ - ['x'] * p2, - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'x', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'x'], - ['x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'p', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] + [' '] * p1 + ['x'], - ['x'] * p2 -] +weapon_data = {'sword': {'cooldown': 100, 'damage': 15}} # набор оружия +mobs_data = {'ninja': {'health': 100, 'exp': 250, 'damage': 6, # тип и характеристики моба + 'attack_type': 'leaf_attack', 'attack_sound': '../data/audio/hit.wav', + 'speed': 3, 'resistance': 3, 'attack_radius': 50, 'notice_radius': 300}} + + +def import_csv_layout(path): # ЗАГРУЗКА ФАЙЛОВ CSV КАРТЫ + terrain_map = [] + with open(path) as level_map: + layout = reader(level_map, delimiter=',') + for row in layout: + terrain_map.append(list(row)) + return terrain_map + + +def import_folder(path): # ОБРАБОТКА КАРТИНОК + surface_list = [] + + for i, j, img_files in walk(path): + for image in img_files: + full_path = path + '/' + image + image_surf = pygame.image.load(full_path).convert_alpha() + surface_list.append(image_surf) + + return surface_list diff --git a/code/enemy.py b/code/enemy.py new file mode 100644 index 0000000..7772598 --- /dev/null +++ b/code/enemy.py @@ -0,0 +1,124 @@ +from data import * +from entity import Entity + + +class Enemy(Entity): + def __init__(self, monster_name, pos, groups, obstacle_sprites, damage_player, add_exp): + super().__init__(groups) + self.sprite_type = 'enemy' + + # стартовый спрайт + self.import_graphics(monster_name) + self.status = 'idle' + self.image = self.animations[self.status][self.frame_index] + + # положение + self.rect = self.image.get_rect(topleft=pos) + self.hitbox = self.rect.inflate(0, -10) + self.obstacle_sprites = obstacle_sprites + + # характеристики + self.monster_name = monster_name + monster_info = mobs_data[self.monster_name] + self.health = monster_info['health'] + self.exp = monster_info['exp'] + self.speed = monster_info['speed'] + self.attack_damage = monster_info['damage'] + self.resistance = monster_info['resistance'] + self.attack_radius = monster_info['attack_radius'] + self.notice_radius = monster_info['notice_radius'] + + # параметры + self.can_attack = True + self.attack_time = None + self.attack_cooldown = 400 + self.damage_player = damage_player + self.add_exp = add_exp + + # звуки + self.death_sound = pygame.mixer.Sound('../data/audio/death.wav') + self.hit_sound = pygame.mixer.Sound('../data/audio/hit.wav') + self.attack_sound = pygame.mixer.Sound(monster_info['attack_sound']) + self.death_sound.set_volume(0.6) + self.hit_sound.set_volume(0.6) + self.attack_sound.set_volume(0.6) + + def import_graphics(self, name): + self.animations = {'idle': [], 'move': [], 'attack': []} + main_path = f'../data/textures/mobs/{name}/' + for animation in self.animations.keys(): + self.animations[animation] = import_folder(main_path + animation) + + def get_player_distance_direction(self, player): + enemy_vec = pygame.math.Vector2(self.rect.center) + player_vec = pygame.math.Vector2(player.rect.center) + distance = (player_vec - enemy_vec).magnitude() + + if distance > 0: + direction = (player_vec - enemy_vec).normalize() + else: + direction = pygame.math.Vector2() + + return (distance, direction) + + def get_status(self, player): + distance = self.get_player_distance_direction(player)[0] + + if distance <= self.attack_radius and self.can_attack: + if self.status != 'attack': + self.frame_index = 0 + self.status = 'attack' + elif distance <= self.notice_radius: + self.status = 'move' + else: + self.status = 'idle' + + def actions(self, player): + if self.status == 'attack': + self.attack_time = pygame.time.get_ticks() + self.damage_player(self.attack_damage) + self.attack_sound.play() + elif self.status == 'move': + self.direction = self.get_player_distance_direction(player)[1] + else: + self.direction = pygame.math.Vector2() + + def animate(self): + animation = self.animations[self.status] + + self.frame_index += self.animation_speed + if self.frame_index >= len(animation): + if self.status == 'attack': + self.can_attack = False + self.frame_index = 0 + + self.image = animation[int(self.frame_index)] + self.rect = self.image.get_rect(center=self.hitbox.center) + + def cooldowns(self): + current_time = pygame.time.get_ticks() + if not self.can_attack: + if current_time - self.attack_time >= self.attack_cooldown: + self.can_attack = True + + def get_damage(self, player): + self.hit_sound.play() + self.direction = self.get_player_distance_direction(player)[1] + self.health -= player.get_full_weapon_damage() + self.hit_time = pygame.time.get_ticks() + + def check_death(self): + if self.health <= 0: + self.kill() + self.add_exp(self.exp) + self.death_sound.play() + + def update(self): + self.move(self.speed) + self.animate() + self.cooldowns() + self.check_death() + + def enemy_update(self, player): + self.get_status(player) + self.actions(player) diff --git a/code/entity.py b/code/entity.py new file mode 100644 index 0000000..fa2cb86 --- /dev/null +++ b/code/entity.py @@ -0,0 +1,44 @@ +import pygame +from math import sin + + +class Entity(pygame.sprite.Sprite): + def __init__(self, groups): + super().__init__(groups) + self.frame_index = 0 + self.animation_speed = 0.15 + self.direction = pygame.math.Vector2() + + def move(self, speed): + if self.direction.magnitude() != 0: + self.direction = self.direction.normalize() + + self.hitbox.x += self.direction.x * speed + self.collision('horizontal') + self.hitbox.y += self.direction.y * speed + self.collision('vertical') + self.rect.center = self.hitbox.center + + def collision(self, direction): + if direction == 'horizontal': + for sprite in self.obstacle_sprites: + if sprite.hitbox.colliderect(self.hitbox): + if self.direction.x > 0: # moving right + self.hitbox.right = sprite.hitbox.left + if self.direction.x < 0: # moving left + self.hitbox.left = sprite.hitbox.right + + if direction == 'vertical': + for sprite in self.obstacle_sprites: + if sprite.hitbox.colliderect(self.hitbox): + if self.direction.y > 0: # moving down + self.hitbox.bottom = sprite.hitbox.top + if self.direction.y < 0: # moving up + self.hitbox.top = sprite.hitbox.bottom + + def wave_value(self): + value = sin(pygame.time.get_ticks()) + if value >= 0: + return 255 + else: + return 0 diff --git a/code/level.py b/code/level.py index d4b77fb..b0adbbc 100644 --- a/code/level.py +++ b/code/level.py @@ -1,32 +1,187 @@ -import pygame -from tile import Tile -from player import Player -from camera import Camera +from random import choice from data import * +from player import Player +from enemy import Enemy -# КЛАСС ОТВЕЧАЕТ ЗА ОТРИСОВКУ И ОБНОВЛЕНИЕ УРОВНЯ class Level: def __init__(self): - self.screen = pygame.display.get_surface() # ПОЛУЧЕНИЕ ЭКРАНА + self.display_surface = pygame.display.get_surface() + self.ui = UI() - # СПРАЙТЫ - self.vis_sprites = Camera() # ВИДИМЫЕ - self.obs_sprites = pygame.sprite.Group() # ОБСТРАКТНЫЕ + # группы основных спрайтов видимых и нет + self.visible_sprites = Camera() + self.obstacle_sprites = pygame.sprite.Group() - self.load_map() + # группа спрайтов способных разрушиться + self.current_attack = None + self.attack_sprites = pygame.sprite.Group() + self.attackable_sprites = pygame.sprite.Group() - def load_map(self): # ЗАГРУЗКА СОХРАНЁННОЙ КАРТЫ - for i, row in enumerate(WORLD_MAP): - for j, col in enumerate(row): - x, y = j * TILESIZE, i * TILESIZE + # генерация карты + self.create_map() - if col == "x": - Tile((x, y), [self.vis_sprites, self.obs_sprites]) # ОТРИСОВКА СПРАЙТА КАРТЫ - if col == "p": - self.player = Player((x, y), [self.vis_sprites], self.obs_sprites) # ОТРИСОВКА СПРАЙТА ИГРОКА + def create_map(self): + layouts = { + 'barryer': import_csv_layout('../data/map/барьеры.csv'), + 'stone': import_csv_layout('../data/map/камни.csv'), + 'entities': import_csv_layout('../data/map/мобы.csv') + } + graphics = {'stone': import_folder('../data/textures/stone')} - def run(self): # ОТРИСОВКА И ОБНОВЛЕНИЕ СПРАЙТОВ - self.vis_sprites.picture(self.player) - self.vis_sprites.update() + for style, layout in layouts.items(): + for row_index, row in enumerate(layout): + for col_index, col in enumerate(row): + if col != '-1': + x = col_index * TILESIZE + y = row_index * TILESIZE + if style == 'barryer': + Tile((x, y), [self.obstacle_sprites], 'invisible') + if style == 'stone': + random_grass_image = choice(graphics['stone']) + Tile((x, y), [self.visible_sprites, self.obstacle_sprites, self.attackable_sprites], + 'stone', random_grass_image) + if style == 'entities': + if col == '2': + self.player = Player((x, y), [self.visible_sprites], self.obstacle_sprites, + self.destroy_attack, self.create_attack) + else: + Enemy("ninja", (x, y), [self.visible_sprites, self.attackable_sprites], + self.obstacle_sprites, self.damage_player, self.add_exp) + + def create_attack(self): # создание атаки и спрайта оружия + self.current_attack = Weapon(self.player, [self.visible_sprites, self.attack_sprites]) + + def destroy_attack(self): # разрушение разрушаемых объектов + if self.current_attack: + self.current_attack.kill() + self.current_attack = None + + def player_attack(self): # удары по другим объектам + if self.attack_sprites: + for attack_sprite in self.attack_sprites: + collision_sprites = pygame.sprite.spritecollide(attack_sprite, self.attackable_sprites, False) + if collision_sprites: + for target_sprite in collision_sprites: + if target_sprite.sprite_type == 'stone': # камни разрушаются с одного удара + target_sprite.kill() + else: # мобы получают урон + target_sprite.get_damage(self.player) + + def damage_player(self, amount): + self.player.health -= amount + self.player.hurt_time = pygame.time.get_ticks() + + def add_exp(self, amount): + self.player.exp += amount + + def run(self): + self.visible_sprites.custom_draw(self.player) + self.ui.display(self.player) + + self.visible_sprites.update() + self.visible_sprites.enemy_update(self.player) + self.player_attack() + + +# КАМЕРА СЛЕДЯЩАЯ ЗА ПЕРСОНАЖЕМ +class Camera(pygame.sprite.Group): + def __init__(self): + super().__init__() + self.display_surface = pygame.display.get_surface() + self.half_width = self.display_surface.get_size()[0] // 2 + self.half_height = self.display_surface.get_size()[1] // 2 + self.offset = pygame.math.Vector2() + + # отрисовка основной карты + self.floor_surf = pygame.image.load('../data/map/map.png').convert() + self.floor_rect = self.floor_surf.get_rect(topleft=(0, 0)) + + def custom_draw(self, player): + self.offset.x = player.rect.centerx - self.half_width # ПОЛУЧЕНИЕ ПОЗИЦИИ ИГРОКА + self.offset.y = player.rect.centery - self.half_height + + floor_offset_pos = self.floor_rect.topleft - self.offset # ОТРИСОВКА ОСНОВНОЙ КАРТЫ ПОД ИГРОКОМ + self.display_surface.blit(self.floor_surf, floor_offset_pos) + + for sprite in sorted(self.sprites(), key=lambda sprite: sprite.rect.centery): + offset_pos = sprite.rect.topleft - self.offset + self.display_surface.blit(sprite.image, offset_pos) + + def enemy_update(self, player): # ОТРИСОВКА МОБОВ + enemy_sprites = [] + for sprite in self.sprites(): + if hasattr(sprite, 'sprite_type') and sprite.sprite_type == 'enemy': + enemy_sprites.append(sprite) + + for enemy in enemy_sprites: + enemy.enemy_update(player) + + +# КЛАСС ОТРИСОВКИ ПЛИТОК +class Tile(pygame.sprite.Sprite): + def __init__(self, pos, groups, sprite_type, surface=pygame.Surface((TILESIZE, TILESIZE))): + super().__init__(groups) + self.sprite_type = sprite_type + y_offset = HITBOX[sprite_type] + self.image = surface + + if sprite_type == 'object': + self.rect = self.image.get_rect(topleft=(pos[0], pos[1] - TILESIZE)) + else: + self.rect = self.image.get_rect(topleft=pos) + + self.hitbox = self.rect.inflate(0, y_offset) + + +# КЛАСС ОРУЖИЯ +class Weapon(pygame.sprite.Sprite): + def __init__(self, player, groups): + super().__init__(groups) + self.sprite_type = 'weapon' + self.image = pygame.image.load(f'../data/textures/sword/{player.status.split("_")[0]}.png').convert_alpha() + + # отрисовка оружия по отношению к герою + if player.status == 'right': + self.rect = self.image.get_rect(midleft=player.rect.midright + pygame.math.Vector2(-3, 16)) + elif player.status == 'left': + self.rect = self.image.get_rect(midright=player.rect.midleft + pygame.math.Vector2(3, 16)) + elif player.status == 'down': + self.rect = self.image.get_rect(midtop=player.rect.midbottom + pygame.math.Vector2(-10, 0)) + else: + self.rect = self.image.get_rect(midbottom=player.rect.midtop + pygame.math.Vector2(-10, 20)) + + +# КЛАСС ИНТРЕФЕЙСА +class UI: + def __init__(self): + self.screen = pygame.display.get_surface() + self.font = pygame.font.SysFont("arial", 24) # размер и формат чисел опыта + + def health_bar(self, player): + pygame.draw.rect(self.screen, '#222222', pygame.Rect(10, 10, 120, 30)) + + # перевод кол-ва здоровья в полоску + ratio = player.health / player.stats['health'] + current_width = pygame.Rect(10, 10, 120, 30).width * ratio + current_rect = pygame.Rect(10, 10, 120, 30).copy() + current_rect.width = current_width + + pygame.draw.rect(self.screen, 'red', current_rect) + pygame.draw.rect(self.screen, 'black', pygame.Rect(10, 10, 120, 30), 3) + + def show_exp(self, exp): + text_surf = self.font.render(str(int(exp)), False, 'white') + x = self.screen.get_size()[0] - 20 # место ячейки опыта + y = self.screen.get_size()[1] - 1040 + text_rect = text_surf.get_rect(bottomright=(x, y)) + + pygame.draw.rect(self.screen, '#222222', text_rect.inflate(20, 20)) # отрисовка опыта и серого фона + self.screen.blit(text_surf, text_rect) + + pygame.draw.rect(self.screen, 'black', text_rect.inflate(20, 20), 3) # отрисовка чёрной рамки + + def display(self, player): + self.health_bar(player) + self.show_exp(player.exp) diff --git a/code/main.py b/code/main.py index 360d929..60d07cb 100644 --- a/code/main.py +++ b/code/main.py @@ -1,17 +1,21 @@ -import pygame, sys +import sys + from data import * from level import Level class Game: def __init__(self): - # ЗАПУСК ИГРЫ pygame.init() self.screen = pygame.display.set_mode((WIDTH, HEIGTH)) pygame.display.set_caption('Pixel Gamble') self.clock = pygame.time.Clock() - self.level = Level() # ЗАГРУЗКА КАРТЫ + self.level = Level() + + main_sound = pygame.mixer.Sound('../data/audio/main.wav') + main_sound.set_volume(0.5) + main_sound.play(loops=-1) def run(self): while True: @@ -19,11 +23,13 @@ class Game: if event.type == pygame.QUIT: pygame.quit() sys.exit() + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + pygame.quit() + sys.exit() self.screen.fill('black') - - self.level.run() # ОТРИСОВКА КАРТЫ - + self.level.run() pygame.display.update() self.clock.tick(FPS) diff --git a/code/player.py b/code/player.py index 6c3c6c7..83e2385 100644 --- a/code/player.py +++ b/code/player.py @@ -1,67 +1,128 @@ -import pygame from data import * +from entity import Entity -# КЛАСС ОТВЕЧАЕТ ЗА ОТРИСОВКУ ИГРОКА В ВЫБРАННОЙ ПОЗИЦИИ -class Player(pygame.sprite.Sprite): - def __init__(self, pos, groups, obs_sprites): +class Player(Entity): + def __init__(self, pos, groups, obstacle_sprites, destroy_attack, create_attack): super().__init__(groups) - self.image = pygame.image.load("../data/textures/player/player.png") # ЗАГРУЗКА - self.rect = self.image.get_rect(topleft=pos) # ОТРИСОВКА - self.hitbox = self.rect.inflate(0, -26) # РАЗМЕР ХИТБОКСА + self.image = pygame.image.load('../data/textures/player/player.png').convert_alpha() + self.rect = self.image.get_rect(topleft=pos) + self.hitbox = self.rect.inflate(-6, HITBOX['player']) - self.point = pygame.math.Vector2() # ПОЗИЦИЯ ИГРОКА - self.obs_sprites = obs_sprites - self.speed = 5 + # стартовое положение спрайта + self.import_player_assets() + self.status = 'down' - def wasd(self): - keyboard = pygame.key.get_pressed() + # параметры героя + self.attacking = False + self.attack_cooldown = 400 + self.attack_time = None + self.obstacle_sprites = obstacle_sprites - # ПЕРМЕЩЕНИЕ Y - if keyboard[pygame.K_w]: - self.point.y = -1 - elif keyboard[pygame.K_s]: - self.point.y = 1 + # оружик героя + self.destroy_attack = destroy_attack + self.weapon_index = 0 + self.create_attack = create_attack + self.weapon = list(weapon_data.keys())[self.weapon_index] + self.can_switch_weapon = True + self.weapon_switch_time = None + self.switch_duration_cooldown = 200 + + # характеристики героя + self.stats = {'health': 300, 'attack': 10, 'speed': 5} + self.max_stats = {'health': 300, 'attack': 20, 'speed': 10} + self.health = self.stats['health'] + self.speed = self.stats['speed'] + self.exp = 0 + + # import a sound + self.weapon_attack_sound = pygame.mixer.Sound('../data/audio/sword.wav') + self.weapon_attack_sound.set_volume(0.4) + + def import_player_assets(self): # получение всех картинок героя + self.animations = {'up': [], 'down': [], 'left': [], 'right': [], + 'right_stand': [], 'left_stand': [], 'up_stand': [], 'down_stand': [], + 'right_attack': [], 'left_attack': [], 'up_attack': [], 'down_attack': []} + + for animation in self.animations.keys(): + full_path = '../data/textures/player/' + animation + self.animations[animation] = import_folder(full_path) + + def input(self): # кнопки + if not self.attacking: + keys = pygame.key.get_pressed() + mouse = pygame.mouse.get_pressed() + + if keys[pygame.K_w]: + self.direction.y = -1 + self.status = 'up' + elif keys[pygame.K_s]: + self.direction.y = 1 + self.status = 'down' + else: + self.direction.y = 0 + + if keys[pygame.K_d]: + self.direction.x = 1 + self.status = 'right' + elif keys[pygame.K_a]: + self.direction.x = -1 + self.status = 'left' + else: + self.direction.x = 0 + + if mouse[0]: + self.attacking = True + self.attack_time = pygame.time.get_ticks() + self.create_attack() + self.weapon_attack_sound.play() + + def get_status(self): # положение героя на поле + if self.direction.x == 0 and self.direction.y == 0: + if not 'stand' in self.status and not 'attack' in self.status: + self.status = self.status + '_stand' + + if self.attacking: + self.direction.x = 0 + self.direction.y = 0 + if not 'attack' in self.status: + if 'stand' in self.status: + self.status = self.status.replace('_stand', '_attack') + else: + self.status = self.status + '_attack' else: - self.point.y = 0 + if 'attack' in self.status: + self.status = self.status.replace('_attack', '') - # ПЕРМЕЩЕНИЕ X - if keyboard[pygame.K_a]: - self.point.x = -1 - elif keyboard[pygame.K_d]: - self.point.x = 1 - else: - self.point.x = 0 + def cooldowns(self): # таймер востановления удара + current_time = pygame.time.get_ticks() - def move(self, speed): # СКОРОСТЬ ПЕРЕДВЕЖЕНИЯ - if self.point.magnitude() != 0: - self.point = self.point.normalize() # ФИКС СКОРОСТИ ПО ДИАГОНАЛИ + if self.attacking: + if current_time - self.attack_time >= self.attack_cooldown + weapon_data[self.weapon]['cooldown']: + self.attacking = False + self.destroy_attack() - self.hitbox.x += self.point.x * speed - self.barrier(True) - self.hitbox.y += self.point.y * speed - self.barrier(False) + if not self.can_switch_weapon: + if current_time - self.weapon_switch_time >= self.switch_duration_cooldown: + self.can_switch_weapon = True - self.rect.center = self.hitbox.center + def animate(self): # анимирование героя + animation = self.animations[self.status] + self.frame_index += self.animation_speed + if self.frame_index >= len(animation): + self.frame_index = 0 - def barrier(self, point): - if point: - for sprite in self.obs_sprites: - if sprite.hitbox.colliderect(self.hitbox): - # СТОЛКНОВЕНИЕ ПО ГОРИЗОНТУ - if self.point.x > 0: # влево - self.hitbox.right = sprite.hitbox.left - if self.point.x < 0: # вправо - self.hitbox.left = sprite.hitbox.right - else: - for sprite in self.obs_sprites: - if sprite.hitbox.colliderect(self.hitbox): - # СТОЛКНОВЕНИЕ ПО ВЕРТИКАЛИ - if self.point.y > 0: # вниз - self.hitbox.bottom = sprite.hitbox.top - if self.point.y < 0: # вверх - self.hitbox.top = sprite.hitbox.bottom + self.image = animation[int(self.frame_index)] + self.rect = self.image.get_rect(center=self.hitbox.center) + + def get_full_weapon_damage(self): # нанесение врагу урона + base_damage = self.stats['attack'] + weapon_damage = weapon_data[self.weapon]['damage'] + return base_damage + weapon_damage def update(self): - self.wasd() - self.move(self.speed) + self.input() + self.cooldowns() + self.get_status() + self.animate() + self.move(self.stats['speed']) diff --git a/data/audio/death.wav b/data/audio/death.wav new file mode 100644 index 0000000..08641f3 Binary files /dev/null and b/data/audio/death.wav differ diff --git a/data/audio/hit.wav b/data/audio/hit.wav new file mode 100644 index 0000000..765b97b Binary files /dev/null and b/data/audio/hit.wav differ diff --git a/data/audio/main.wav b/data/audio/main.wav new file mode 100644 index 0000000..c7c3474 Binary files /dev/null and b/data/audio/main.wav differ diff --git a/data/audio/sword.wav b/data/audio/sword.wav new file mode 100644 index 0000000..2e962d0 Binary files /dev/null and b/data/audio/sword.wav differ diff --git a/data/map/map.png b/data/map/map.png new file mode 100644 index 0000000..7fce7d2 Binary files /dev/null and b/data/map/map.png differ diff --git a/data/map/барьеры.csv b/data/map/барьеры.csv new file mode 100644 index 0000000..1213d46 --- /dev/null +++ b/data/map/барьеры.csv @@ -0,0 +1,17 @@ +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 +-1,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,-1 +-1,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,-1 +-1,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,395,-1 +-1,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,-1 +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 diff --git a/data/map/камни.csv b/data/map/камни.csv new file mode 100644 index 0000000..3469c04 --- /dev/null +++ b/data/map/камни.csv @@ -0,0 +1,17 @@ +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 +-1,-1,-1,-1,-1,-1,-1,-1,-1,-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obs/ninja/attack/0.png new file mode 100644 index 0000000..66e15a1 Binary files /dev/null and b/data/textures/mobs/ninja/attack/0.png differ diff --git a/data/textures/mobs/ninja/attack/1.png b/data/textures/mobs/ninja/attack/1.png new file mode 100644 index 0000000..2982075 Binary files /dev/null and b/data/textures/mobs/ninja/attack/1.png differ diff --git a/data/textures/mobs/ninja/attack/2.png b/data/textures/mobs/ninja/attack/2.png new file mode 100644 index 0000000..67c0ccf Binary files /dev/null and b/data/textures/mobs/ninja/attack/2.png differ diff --git a/data/textures/mobs/ninja/idle/0.png b/data/textures/mobs/ninja/idle/0.png new file mode 100644 index 0000000..66e15a1 Binary files /dev/null and b/data/textures/mobs/ninja/idle/0.png differ diff --git a/data/textures/mobs/ninja/idle/1.png b/data/textures/mobs/ninja/idle/1.png new file mode 100644 index 0000000..2982075 Binary files /dev/null and b/data/textures/mobs/ninja/idle/1.png differ diff --git a/data/textures/mobs/ninja/idle/2.png b/data/textures/mobs/ninja/idle/2.png new file mode 100644 index 0000000..67c0ccf Binary files /dev/null and b/data/textures/mobs/ninja/idle/2.png differ diff --git a/data/textures/mobs/ninja/move/0.png b/data/textures/mobs/ninja/move/0.png new file mode 100644 index 0000000..66e15a1 Binary files /dev/null and b/data/textures/mobs/ninja/move/0.png differ diff --git a/data/textures/mobs/ninja/move/1.png b/data/textures/mobs/ninja/move/1.png new file mode 100644 index 0000000..2982075 Binary files /dev/null and b/data/textures/mobs/ninja/move/1.png differ diff --git a/data/textures/mobs/ninja/move/2.png b/data/textures/mobs/ninja/move/2.png new file mode 100644 index 0000000..67c0ccf Binary files /dev/null and b/data/textures/mobs/ninja/move/2.png differ diff --git a/data/textures/player/down/down_1.png b/data/textures/player/down/down_1.png new file mode 100644 index 0000000..9904732 Binary files /dev/null and b/data/textures/player/down/down_1.png differ diff --git a/data/textures/player/down/down_2.png b/data/textures/player/down/down_2.png new file mode 100644 index 0000000..d8f379f Binary files /dev/null and b/data/textures/player/down/down_2.png differ diff --git a/data/textures/player/down/down_3.png b/data/textures/player/down/down_3.png new file mode 100644 index 0000000..fce977e Binary files /dev/null and b/data/textures/player/down/down_3.png differ diff --git a/data/textures/player/down/down_4.png b/data/textures/player/down/down_4.png new file mode 100644 index 0000000..6649d40 Binary files /dev/null and b/data/textures/player/down/down_4.png differ diff --git a/data/textures/player/down/down_5.png b/data/textures/player/down/down_5.png new file mode 100644 index 0000000..93a3e47 Binary files /dev/null and b/data/textures/player/down/down_5.png differ diff --git a/data/textures/player/down/down_6.png b/data/textures/player/down/down_6.png new file mode 100644 index 0000000..9df67cd Binary files /dev/null and b/data/textures/player/down/down_6.png differ diff --git a/data/textures/player/down/down_7.png b/data/textures/player/down/down_7.png new file mode 100644 index 0000000..7e14dc2 Binary files /dev/null and b/data/textures/player/down/down_7.png differ diff --git a/data/textures/player/down/down_8.png b/data/textures/player/down/down_8.png new file mode 100644 index 0000000..a63e567 Binary files /dev/null and b/data/textures/player/down/down_8.png differ diff --git a/data/textures/player/down_attack/attack_down.png b/data/textures/player/down_attack/attack_down.png new file mode 100644 index 0000000..fce977e Binary files /dev/null and b/data/textures/player/down_attack/attack_down.png differ diff --git a/data/textures/player/down_stand/stand_down.png b/data/textures/player/down_stand/stand_down.png new file mode 100644 index 0000000..9904732 Binary files /dev/null and b/data/textures/player/down_stand/stand_down.png differ diff --git a/data/textures/player/left/left_1.png b/data/textures/player/left/left_1.png new file mode 100644 index 0000000..f182fa2 Binary files /dev/null and b/data/textures/player/left/left_1.png differ diff --git a/data/textures/player/left/left_2.png b/data/textures/player/left/left_2.png new file mode 100644 index 0000000..30550e8 Binary files /dev/null and b/data/textures/player/left/left_2.png differ diff --git a/data/textures/player/left/left_3.png b/data/textures/player/left/left_3.png new file mode 100644 index 0000000..0d6c93b Binary files /dev/null and b/data/textures/player/left/left_3.png differ diff --git a/data/textures/player/left/left_4.png b/data/textures/player/left/left_4.png new file mode 100644 index 0000000..47ae804 Binary files /dev/null and b/data/textures/player/left/left_4.png differ diff --git a/data/textures/player/left/left_5.png b/data/textures/player/left/left_5.png new file mode 100644 index 0000000..5c7846b Binary files /dev/null and b/data/textures/player/left/left_5.png differ diff --git a/data/textures/player/left/left_6.png b/data/textures/player/left/left_6.png new file mode 100644 index 0000000..b60a134 Binary files /dev/null and b/data/textures/player/left/left_6.png differ diff --git a/data/textures/player/left/left_7.png b/data/textures/player/left/left_7.png new file mode 100644 index 0000000..2e40a72 Binary files /dev/null and b/data/textures/player/left/left_7.png differ diff --git a/data/textures/player/left/left_8.png b/data/textures/player/left/left_8.png new file mode 100644 index 0000000..4dc468c Binary files /dev/null and b/data/textures/player/left/left_8.png differ diff --git a/data/textures/player/left_attack/attack_left.png b/data/textures/player/left_attack/attack_left.png new file mode 100644 index 0000000..0d6c93b Binary files /dev/null and b/data/textures/player/left_attack/attack_left.png differ diff --git a/data/textures/player/left_stand/stand_left.png b/data/textures/player/left_stand/stand_left.png new file mode 100644 index 0000000..f182fa2 Binary files /dev/null and b/data/textures/player/left_stand/stand_left.png differ diff --git a/data/textures/player/right/right_1.png b/data/textures/player/right/right_1.png new file mode 100644 index 0000000..c0aa317 Binary files /dev/null and b/data/textures/player/right/right_1.png differ diff --git a/data/textures/player/right/right_2.png b/data/textures/player/right/right_2.png new file mode 100644 index 0000000..d4a4c9b Binary files /dev/null and b/data/textures/player/right/right_2.png differ diff --git a/data/textures/player/right/right_3.png b/data/textures/player/right/right_3.png new file mode 100644 index 0000000..4b7fc89 Binary files /dev/null and b/data/textures/player/right/right_3.png differ diff --git a/data/textures/player/right/right_4.png b/data/textures/player/right/right_4.png new file mode 100644 index 0000000..846d11b Binary files /dev/null and b/data/textures/player/right/right_4.png differ diff --git a/data/textures/player/right/right_5.png b/data/textures/player/right/right_5.png new file mode 100644 index 0000000..97b5bfa Binary files /dev/null and b/data/textures/player/right/right_5.png differ diff --git a/data/textures/player/right/right_6.png b/data/textures/player/right/right_6.png new file mode 100644 index 0000000..9430cd1 Binary files /dev/null and b/data/textures/player/right/right_6.png differ diff --git a/data/textures/player/right/right_7.png b/data/textures/player/right/right_7.png new file mode 100644 index 0000000..81ede9e Binary files /dev/null and b/data/textures/player/right/right_7.png differ diff --git a/data/textures/player/right/right_8.png b/data/textures/player/right/right_8.png new file mode 100644 index 0000000..7d195fa Binary files /dev/null and b/data/textures/player/right/right_8.png differ diff --git a/data/textures/player/right_attack/attack_right.png b/data/textures/player/right_attack/attack_right.png new file mode 100644 index 0000000..4b7fc89 Binary files /dev/null and b/data/textures/player/right_attack/attack_right.png differ diff --git a/data/textures/player/right_stand/stand_right.png b/data/textures/player/right_stand/stand_right.png new file mode 100644 index 0000000..c0aa317 Binary files /dev/null and b/data/textures/player/right_stand/stand_right.png differ diff --git a/data/textures/player/up/up_1.png b/data/textures/player/up/up_1.png new file mode 100644 index 0000000..04584f5 Binary files /dev/null and b/data/textures/player/up/up_1.png differ diff --git a/data/textures/player/up/up_2.png b/data/textures/player/up/up_2.png new file mode 100644 index 0000000..7f46146 Binary files /dev/null and b/data/textures/player/up/up_2.png differ diff --git a/data/textures/player/up/up_3.png b/data/textures/player/up/up_3.png new file mode 100644 index 0000000..a887fb6 Binary files /dev/null and b/data/textures/player/up/up_3.png differ diff --git a/data/textures/player/up/up_4.png b/data/textures/player/up/up_4.png new file mode 100644 index 0000000..4c34204 Binary files /dev/null and b/data/textures/player/up/up_4.png differ diff --git a/data/textures/player/up/up_5.png b/data/textures/player/up/up_5.png new file mode 100644 index 0000000..d2a81fc Binary files /dev/null and b/data/textures/player/up/up_5.png differ diff --git a/data/textures/player/up/up_6.png b/data/textures/player/up/up_6.png new file mode 100644 index 0000000..abf0629 Binary files /dev/null and b/data/textures/player/up/up_6.png differ diff --git a/data/textures/player/up/up_7.png b/data/textures/player/up/up_7.png new file mode 100644 index 0000000..d8d941b Binary files /dev/null and b/data/textures/player/up/up_7.png differ diff --git a/data/textures/player/up/up_8.png b/data/textures/player/up/up_8.png new file mode 100644 index 0000000..4ab408e Binary files /dev/null and b/data/textures/player/up/up_8.png differ diff --git a/data/textures/player/up_attack/attack_up.png b/data/textures/player/up_attack/attack_up.png new file mode 100644 index 0000000..a887fb6 Binary files /dev/null and b/data/textures/player/up_attack/attack_up.png differ diff --git a/data/textures/player/up_stand/stand_up.png b/data/textures/player/up_stand/stand_up.png new file mode 100644 index 0000000..04584f5 Binary files /dev/null and b/data/textures/player/up_stand/stand_up.png differ diff --git a/data/textures/stone/(1).png b/data/textures/stone/(1).png new file mode 100644 index 0000000..f389b5b Binary files /dev/null and b/data/textures/stone/(1).png differ diff --git a/data/textures/stone/(2).png b/data/textures/stone/(2).png new file mode 100644 index 0000000..8b3d9a5 Binary files /dev/null and b/data/textures/stone/(2).png differ diff --git a/data/textures/sword/down.png b/data/textures/sword/down.png new file mode 100644 index 0000000..ebcfa93 Binary files /dev/null and b/data/textures/sword/down.png differ diff --git a/data/textures/sword/left.png b/data/textures/sword/left.png new file mode 100644 index 0000000..34abbfa Binary files /dev/null and b/data/textures/sword/left.png differ diff --git a/data/textures/sword/right.png b/data/textures/sword/right.png new file mode 100644 index 0000000..fd96c2c Binary files /dev/null and b/data/textures/sword/right.png differ diff --git a/data/textures/sword/up.png b/data/textures/sword/up.png new file mode 100644 index 0000000..5cac8d4 Binary files /dev/null and b/data/textures/sword/up.png differ