commit bfe6405331610998a684e50427b515580101dcd2 Author: Rayline Date: Wed Mar 9 16:59:58 2022 +0100 Rycerz istnieje diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f73443c --- /dev/null +++ b/.gitignore @@ -0,0 +1,152 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3c86f3f --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# 🏰 WMICraft + diff --git a/colors.py b/colors.py new file mode 100644 index 0000000..8a8f41b --- /dev/null +++ b/colors.py @@ -0,0 +1,6 @@ +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) +ORANGE = (249, 141, 42) +RED = (255, 58, 58) + +FONT_DARK = (37, 37, 37) diff --git a/constants.py b/constants.py new file mode 100644 index 0000000..7c7cb50 --- /dev/null +++ b/constants.py @@ -0,0 +1,22 @@ +GAME_TITLE = 'WMICraft' +WINDOW_HEIGHT = 800 +WINDOW_WIDTH = 1360 +GRID_CELL_PADDING = 5 +GRID_CELL_WIDTH = 36 +GRID_CELL_HEIGHT = 36 +ROWS = 19 +COLUMNS = 24 +BORDER_WIDTH = 10 +BORDER_RADIUS = 5 +FPS_COUNT = 60 +TILES = [ + 'grass1.png', + 'grass2.png', + 'grass3.png', + # 'grass4.png', + # 'grass5.png', + # 'grass6.png', + 'sand.png', + 'water.png', + 'grass_with_tree.jpg', +] \ No newline at end of file diff --git a/field.py b/field.py new file mode 100644 index 0000000..111c999 --- /dev/null +++ b/field.py @@ -0,0 +1,4 @@ +class Field: + def __init__(self, texture_path, converted_texture): + self.texture_path = texture_path + self.converted_texture = converted_texture diff --git a/game.py b/game.py new file mode 100644 index 0000000..87956ec --- /dev/null +++ b/game.py @@ -0,0 +1,136 @@ +import pygame +import sys + +from colors import FONT_DARK, WHITE +from constants import GAME_TITLE, WINDOW_WIDTH, WINDOW_HEIGHT, FPS_COUNT, TILES +from grid import Grid +from helpers import draw_text +from logs import Logs +from stats import Stats +from knight import Knight + + +class Game: + def __init__(self): + pygame.init() + pygame.display.set_caption(GAME_TITLE) + pygame.display.set_icon(pygame.image.load('resources/icons/sword.png')) + + self.screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) + self.clock = pygame.time.Clock() + + self.tiles = [] + for tile_path in TILES: + converted_tile = pygame.image.load('resources/textures/' + tile_path).convert_alpha() + self.tiles.append((tile_path, converted_tile)) + + self.bg = pygame.image.load("resources/textures/bg.jpg") + + click = False + + def main_menu(self): + while True: + self.screen.blit(self.bg, (0, 0)) + + pygame.draw.rect(self.screen, (255, 255, 255), pygame.Rect(800, 100, 400, 500), 0, 5) + draw_text('MAIN MENU', FONT_DARK, self.screen, 850, 150, 30, True) + + mx, my = pygame.mouse.get_pos() + + button_1 = pygame.Rect(850, 250, 300, 50) + button_2 = pygame.Rect(850, 350, 300, 50) + button_3 = pygame.Rect(850, 450, 300, 50) + if button_1.collidepoint((mx, my)): + if click: + self.game() + if button_2.collidepoint((mx, my)): + if click: + self.options() + if button_3.collidepoint((mx, my)): + if click: + self.credits() + pygame.draw.rect(self.screen, (0, 191, 255), button_1, 0, 4) + draw_text('PLAY', WHITE, self.screen, 870, 255) + + pygame.draw.rect(self.screen, (0, 191, 255), button_2, 0, 4) + draw_text('OPTIONS', WHITE, self.screen, 870, 355) + + pygame.draw.rect(self.screen, (0, 191, 255), button_3, 0, 4) + draw_text('CREDITS', WHITE, self.screen, 870, 455) + + click = False + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit() + sys.exit() + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + pygame.quit() + sys.exit() + if event.type == pygame.MOUSEBUTTONDOWN: + if event.button == 1: + click = True + + pygame.display.update() + self.clock.tick(60) + + def options(self): + running = True + while running: + self.screen.fill((0, 0, 0)) + + draw_text('options', WHITE, self.screen, 20, 20, 30) + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + running = False + + pygame.display.update() + self.clock.tick(60) + + def credits(self): + running = True + while running: + self.screen.fill((0, 0, 0)) + + draw_text('credits', WHITE, self.screen, 20, 20, 30) + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + running = False + + pygame.display.update() + self.clock.tick(60) + + def game(self): + running = True + grid = Grid(self.tiles) + stats = Stats() + logs = Logs() + + while running: + self.screen.blit(self.bg, (0, 0)) + + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit() + sys.exit() + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + running = False + + grid.draw(self.screen) + stats.draw(self.screen) + logs.draw(self.screen) + + knight1 = Knight(400, 200, "/resources/textures/knight.png") + knights_list = pygame.sprite.Group() + knights_list.add(knight1) + knights_list.draw(self.screen) + + pygame.display.update() + self.clock.tick(FPS_COUNT) diff --git a/grid.py b/grid.py new file mode 100644 index 0000000..891c618 --- /dev/null +++ b/grid.py @@ -0,0 +1,35 @@ +import pygame +import random +from field import Field + +from constants import ROWS, COLUMNS, GRID_CELL_PADDING, GRID_CELL_WIDTH, GRID_CELL_HEIGHT, BORDER_WIDTH, BORDER_RADIUS + + +class Grid: + def __init__(self, textures): + self.textures = textures + self.grid = [] + for row in range(ROWS): + self.grid.append([]) + for _ in range(COLUMNS): + texture_path, converted_texture = self.get_random_texture() + field = Field(texture_path, converted_texture) + self.grid[row].append(field) + + def get_random_texture(self): + texture_index = random.randint(0, len(self.textures) - 1) + return self.textures[texture_index] + + def draw(self, screen): + bg_width = (GRID_CELL_PADDING + GRID_CELL_WIDTH) * COLUMNS + BORDER_WIDTH + bg_height = (GRID_CELL_PADDING + GRID_CELL_HEIGHT) * ROWS + BORDER_WIDTH + pygame.draw.rect(screen, (255, 255, 255), pygame.Rect(5, 5, bg_width, bg_height), 0, BORDER_RADIUS) + + for row in range(ROWS): + for column in range(COLUMNS): + box_rect = [(GRID_CELL_PADDING + GRID_CELL_WIDTH) * column + GRID_CELL_PADDING + 7, + (GRID_CELL_PADDING + GRID_CELL_HEIGHT) * row + GRID_CELL_PADDING + 7, + GRID_CELL_WIDTH, + GRID_CELL_HEIGHT] + image = self.grid[row][column].converted_texture + screen.blit(pygame.transform.scale(image, (GRID_CELL_WIDTH, GRID_CELL_HEIGHT)), box_rect) diff --git a/helpers.py b/helpers.py new file mode 100644 index 0000000..63238b6 --- /dev/null +++ b/helpers.py @@ -0,0 +1,12 @@ +import pygame + + +def draw_text(text, color, surface, x, y, text_size=30, is_bold=False): + if is_bold: + font = pygame.font.Font('resources/fonts/Poppins-SemiBold.ttf', text_size) + else: + font = pygame.font.Font('resources/fonts/Poppins-Regular.ttf', text_size) + textobj = font.render(text, 1, color) + textrect = textobj.get_rect() + textrect.topleft = (x, y) + surface.blit(textobj, textrect) diff --git a/knight.py b/knight.py new file mode 100644 index 0000000..a9e634c --- /dev/null +++ b/knight.py @@ -0,0 +1,19 @@ +import pygame.image + +from constants import ROWS, COLUMNS, GRID_CELL_PADDING, GRID_CELL_WIDTH, GRID_CELL_HEIGHT, BORDER_WIDTH, BORDER_RADIUS, \ + WINDOW_WIDTH, WINDOW_HEIGHT + +class Knight(pygame.sprite.Sprite): + def __init__(self, x, y, img): + super().__init__() + self.x = x + self.y = y + self.images = [] + self.image = pygame.image.load("resources/textures/knight.png") + self.image = pygame.transform.scale(self.image, (40, 40)) + self.images.append(self.image) + self.rect = self.image.get_rect() + + knights_list = pygame.sprite.Group() + + diff --git a/logs.py b/logs.py new file mode 100644 index 0000000..beaff27 --- /dev/null +++ b/logs.py @@ -0,0 +1,25 @@ +import pygame + +from colors import FONT_DARK, ORANGE, WHITE, RED +from constants import COLUMNS, GRID_CELL_PADDING, GRID_CELL_WIDTH, BORDER_WIDTH, BORDER_RADIUS +from helpers import draw_text + + +class Logs: + def __init__(self): + self.grid = [] + + def draw(self, screen): + x = (GRID_CELL_PADDING + GRID_CELL_WIDTH) * COLUMNS + BORDER_WIDTH + 15 + y = 470 + + # background + pygame.draw.rect(screen, WHITE, pygame.Rect(x, y, 340, 323), 0, BORDER_RADIUS) + + # title + draw_text('LOGS', FONT_DARK, screen, x + 120, y + 10, 36) + pygame.draw.rect(screen, ORANGE, pygame.Rect(x, y + 65, 340, 3)) + + # texts + draw_text('AI Blue: Zniszczyła fortecę (4, 8).', FONT_DARK, screen, x + 35, y + 90, 16) + draw_text('AI Red: Zniszczyła fortecę (12, 5).', FONT_DARK, screen, x + 35, y + 120, 16) diff --git a/main.py b/main.py new file mode 100644 index 0000000..3cf2c8a --- /dev/null +++ b/main.py @@ -0,0 +1,5 @@ +from game import Game + +if __name__ == '__main__': + game = Game() + game.main_menu() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ad0de46 Binary files /dev/null and b/requirements.txt differ diff --git a/resources/fonts/OFL.txt b/resources/fonts/OFL.txt new file mode 100644 index 0000000..76df3b5 --- /dev/null +++ b/resources/fonts/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/resources/fonts/Poppins-Black.ttf b/resources/fonts/Poppins-Black.ttf new file mode 100644 index 0000000..71c0f99 Binary files /dev/null and b/resources/fonts/Poppins-Black.ttf differ diff --git a/resources/fonts/Poppins-BlackItalic.ttf b/resources/fonts/Poppins-BlackItalic.ttf new file mode 100644 index 0000000..7aeb58b Binary files /dev/null and b/resources/fonts/Poppins-BlackItalic.ttf differ diff --git a/resources/fonts/Poppins-Bold.ttf b/resources/fonts/Poppins-Bold.ttf new file mode 100644 index 0000000..00559ee Binary files /dev/null and b/resources/fonts/Poppins-Bold.ttf differ diff --git a/resources/fonts/Poppins-BoldItalic.ttf b/resources/fonts/Poppins-BoldItalic.ttf new file mode 100644 index 0000000..e61e8e8 Binary files /dev/null and b/resources/fonts/Poppins-BoldItalic.ttf differ diff --git a/resources/fonts/Poppins-ExtraBold.ttf b/resources/fonts/Poppins-ExtraBold.ttf new file mode 100644 index 0000000..df70936 Binary files /dev/null and b/resources/fonts/Poppins-ExtraBold.ttf differ diff --git a/resources/fonts/Poppins-ExtraBoldItalic.ttf b/resources/fonts/Poppins-ExtraBoldItalic.ttf new file mode 100644 index 0000000..14d2b37 Binary files /dev/null and b/resources/fonts/Poppins-ExtraBoldItalic.ttf differ diff --git a/resources/fonts/Poppins-ExtraLight.ttf b/resources/fonts/Poppins-ExtraLight.ttf new file mode 100644 index 0000000..e76ec69 Binary files /dev/null and b/resources/fonts/Poppins-ExtraLight.ttf differ diff --git a/resources/fonts/Poppins-ExtraLightItalic.ttf b/resources/fonts/Poppins-ExtraLightItalic.ttf new file mode 100644 index 0000000..89513d9 Binary files /dev/null and b/resources/fonts/Poppins-ExtraLightItalic.ttf differ diff --git a/resources/fonts/Poppins-Italic.ttf b/resources/fonts/Poppins-Italic.ttf new file mode 100644 index 0000000..12b7b3c Binary files /dev/null and b/resources/fonts/Poppins-Italic.ttf differ diff --git a/resources/fonts/Poppins-Light.ttf b/resources/fonts/Poppins-Light.ttf new file mode 100644 index 0000000..bc36bcc Binary files /dev/null and b/resources/fonts/Poppins-Light.ttf differ diff --git a/resources/fonts/Poppins-LightItalic.ttf b/resources/fonts/Poppins-LightItalic.ttf new file mode 100644 index 0000000..9e70be6 Binary files /dev/null and b/resources/fonts/Poppins-LightItalic.ttf differ diff --git a/resources/fonts/Poppins-Medium.ttf b/resources/fonts/Poppins-Medium.ttf new file mode 100644 index 0000000..6bcdcc2 Binary files /dev/null and b/resources/fonts/Poppins-Medium.ttf differ diff --git a/resources/fonts/Poppins-MediumItalic.ttf b/resources/fonts/Poppins-MediumItalic.ttf new file mode 100644 index 0000000..be67410 Binary files /dev/null and b/resources/fonts/Poppins-MediumItalic.ttf differ diff --git a/resources/fonts/Poppins-Regular.ttf b/resources/fonts/Poppins-Regular.ttf new file mode 100644 index 0000000..9f0c71b Binary files /dev/null and b/resources/fonts/Poppins-Regular.ttf differ diff --git a/resources/fonts/Poppins-SemiBold.ttf b/resources/fonts/Poppins-SemiBold.ttf new file mode 100644 index 0000000..74c726e Binary files /dev/null and b/resources/fonts/Poppins-SemiBold.ttf differ diff --git a/resources/fonts/Poppins-SemiBoldItalic.ttf b/resources/fonts/Poppins-SemiBoldItalic.ttf new file mode 100644 index 0000000..3e6c942 Binary files /dev/null and b/resources/fonts/Poppins-SemiBoldItalic.ttf differ diff --git a/resources/fonts/Poppins-Thin.ttf b/resources/fonts/Poppins-Thin.ttf new file mode 100644 index 0000000..03e7366 Binary files /dev/null and b/resources/fonts/Poppins-Thin.ttf differ diff --git a/resources/fonts/Poppins-ThinItalic.ttf b/resources/fonts/Poppins-ThinItalic.ttf new file mode 100644 index 0000000..e26db5d Binary files /dev/null and b/resources/fonts/Poppins-ThinItalic.ttf differ diff --git a/resources/icons/sword.png b/resources/icons/sword.png new file mode 100644 index 0000000..8cb32dd Binary files /dev/null and b/resources/icons/sword.png differ diff --git a/resources/textures/License free.txt b/resources/textures/License free.txt new file mode 100644 index 0000000..c2c3c1b --- /dev/null +++ b/resources/textures/License free.txt @@ -0,0 +1,45 @@ +IMPORTANT NOTICE: This license only applies if you downloaded this content as +an unsubscribed user. If you are a premium user (ie, you pay a subscription) +you are bound to the license terms described in the accompanying file +"License premium.txt". + +--------------------- + +You must attribute the image to its author: + +In order to use a content or a part of it, you must attribute it to vectorpocket / Freepik, +so we will be able to continue creating new graphic resources every day. + + +How to attribute it? + +For websites: + +Please, copy this code on your website to accredit the author: +Designed by vectorpocket / Freepik + +For printing: + +Paste this text on the final work so the authorship is known. +- For example, in the acknowledgements chapter of a book: +"Designed by vectorpocket / Freepik" + + +You are free to use this image: + +- For both personal and commercial projects and to modify it. +- In a website or presentation template or application or as part of your design. + +You are not allowed to: + +- Sub-license, resell or rent it. +- Include it in any online or offline archive or database. + +The full terms of the license are described in section 7 of the Freepik +terms of use, available online in the following link: + + http://www.freepik.com/terms_of_use + +The terms described in the above link have precedence over the terms described +in the present document. In case of disagreement, the Freepik Terms of Use +will prevail. diff --git a/resources/textures/License premium.txt b/resources/textures/License premium.txt new file mode 100644 index 0000000..c6cd87a --- /dev/null +++ b/resources/textures/License premium.txt @@ -0,0 +1,30 @@ +IMPORTANT NOTICE: This license only applies if you downloaded this content as +a subscribed (or "premium") user. If you are an unsubscribed user (or "free" +user) you are bound to the license terms described in the accompanying file +"License free.txt". + +--------------------- + +You can download from your profile in Freepik a personalized license stating +your right to use this content as a "premium" user: + + https://profile.freepik.com/my_downloads + +You are free to use this image: + +- For both personal and commercial projects and to modify it. +- In a website or presentation template or application or as part of your design. + +You are not allowed to: + +- Sub-license, resell or rent it. +- Include it in any online or offline archive or database. + +The full terms of the license are described in sections 7 and 8 of the Freepik +terms of use, available online in the following link: + + http://www.freepik.com/terms_of_use + +The terms described in the above link have precedence over the terms described +in the present document. In case of disagreement, the Freepik Terms of Use +will prevail. diff --git a/resources/textures/bg.jpg b/resources/textures/bg.jpg new file mode 100644 index 0000000..c6825d8 Binary files /dev/null and b/resources/textures/bg.jpg differ diff --git a/resources/textures/data.txt b/resources/textures/data.txt new file mode 100644 index 0000000..464f696 --- /dev/null +++ b/resources/textures/data.txt @@ -0,0 +1,19 @@ +........................ +.P...................... +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ +........................ diff --git a/resources/textures/grass1.png b/resources/textures/grass1.png new file mode 100644 index 0000000..dd88981 Binary files /dev/null and b/resources/textures/grass1.png differ diff --git a/resources/textures/grass2.png b/resources/textures/grass2.png new file mode 100644 index 0000000..c07ab8f Binary files /dev/null and b/resources/textures/grass2.png differ diff --git a/resources/textures/grass3.png b/resources/textures/grass3.png new file mode 100644 index 0000000..4fac085 Binary files /dev/null and b/resources/textures/grass3.png differ diff --git a/resources/textures/grass4.png b/resources/textures/grass4.png new file mode 100644 index 0000000..74cb3d1 Binary files /dev/null and b/resources/textures/grass4.png differ diff --git a/resources/textures/grass5.png b/resources/textures/grass5.png new file mode 100644 index 0000000..d348b2d Binary files /dev/null and b/resources/textures/grass5.png differ diff --git a/resources/textures/grass6.png b/resources/textures/grass6.png new file mode 100644 index 0000000..fa788ab Binary files /dev/null and b/resources/textures/grass6.png differ diff --git a/resources/textures/grass_with_tree.jpg b/resources/textures/grass_with_tree.jpg new file mode 100644 index 0000000..56af6b8 Binary files /dev/null and b/resources/textures/grass_with_tree.jpg differ diff --git a/resources/textures/knight.png b/resources/textures/knight.png new file mode 100644 index 0000000..0024f64 Binary files /dev/null and b/resources/textures/knight.png differ diff --git a/resources/textures/sand.png b/resources/textures/sand.png new file mode 100644 index 0000000..51c072d Binary files /dev/null and b/resources/textures/sand.png differ diff --git a/resources/textures/shield_blue.png b/resources/textures/shield_blue.png new file mode 100644 index 0000000..2fab665 Binary files /dev/null and b/resources/textures/shield_blue.png differ diff --git a/resources/textures/shield_red.png b/resources/textures/shield_red.png new file mode 100644 index 0000000..686eb4f Binary files /dev/null and b/resources/textures/shield_red.png differ diff --git a/resources/textures/t1.jpeg b/resources/textures/t1.jpeg new file mode 100644 index 0000000..9a0887f Binary files /dev/null and b/resources/textures/t1.jpeg differ diff --git a/resources/textures/t10.jpg b/resources/textures/t10.jpg new file mode 100644 index 0000000..7b37316 Binary files /dev/null and b/resources/textures/t10.jpg differ diff --git a/resources/textures/t2.jpg b/resources/textures/t2.jpg new file mode 100644 index 0000000..b8ecd88 Binary files /dev/null and b/resources/textures/t2.jpg differ diff --git a/resources/textures/t3.jpg b/resources/textures/t3.jpg new file mode 100644 index 0000000..5a5cde1 Binary files /dev/null and b/resources/textures/t3.jpg differ diff --git a/resources/textures/t4.jpg b/resources/textures/t4.jpg new file mode 100644 index 0000000..ed0f42c Binary files /dev/null and b/resources/textures/t4.jpg differ diff --git a/resources/textures/t5.jpg b/resources/textures/t5.jpg new file mode 100644 index 0000000..4d32bfd Binary files /dev/null and b/resources/textures/t5.jpg differ diff --git a/resources/textures/t6.jpg b/resources/textures/t6.jpg new file mode 100644 index 0000000..8c50677 Binary files /dev/null and b/resources/textures/t6.jpg differ diff --git a/resources/textures/t7.jpg b/resources/textures/t7.jpg new file mode 100644 index 0000000..129c1d8 Binary files /dev/null and b/resources/textures/t7.jpg differ diff --git a/resources/textures/t8.jpg b/resources/textures/t8.jpg new file mode 100644 index 0000000..bde20cf Binary files /dev/null and b/resources/textures/t8.jpg differ diff --git a/resources/textures/t9.jpg b/resources/textures/t9.jpg new file mode 100644 index 0000000..088a355 Binary files /dev/null and b/resources/textures/t9.jpg differ diff --git a/resources/textures/tree1.png b/resources/textures/tree1.png new file mode 100644 index 0000000..48637da Binary files /dev/null and b/resources/textures/tree1.png differ diff --git a/resources/textures/tree2.png b/resources/textures/tree2.png new file mode 100644 index 0000000..2f8fa74 Binary files /dev/null and b/resources/textures/tree2.png differ diff --git a/resources/textures/water.png b/resources/textures/water.png new file mode 100644 index 0000000..28b45db Binary files /dev/null and b/resources/textures/water.png differ diff --git a/stats.py b/stats.py new file mode 100644 index 0000000..f1e9994 --- /dev/null +++ b/stats.py @@ -0,0 +1,44 @@ +import pygame + +from colors import FONT_DARK, ORANGE, WHITE, RED +from constants import COLUMNS, GRID_CELL_PADDING, GRID_CELL_WIDTH, BORDER_WIDTH, BORDER_RADIUS +from helpers import draw_text + + +class Stats: + def __init__(self): + self.grid = [] + + def draw(self, screen): + x = (GRID_CELL_PADDING + GRID_CELL_WIDTH) * COLUMNS + BORDER_WIDTH + 15 + y = 5 + + # background + pygame.draw.rect(screen, WHITE, pygame.Rect(x, y, 340, 450), 0, BORDER_RADIUS) + + # title + draw_text('STATS', FONT_DARK, screen, x + 120, y + 10, 36) + pygame.draw.rect(screen, ORANGE, pygame.Rect(x, y + 65, 340, 3)) + + # shields + shield_blue = pygame.image.load('resources/textures/shield_blue.png') + shield_red = pygame.image.load('resources/textures/shield_red.png') + screen.blit(shield_blue, (x + 20, y + 80)) + screen.blit(shield_red, (x + 200, y + 80)) + draw_text('VS', FONT_DARK, screen, x + 150, y + 120, 36) + + # HP bars + pygame.draw.rect(screen, RED, pygame.Rect(x + 30, y + 210, 100, 15), 0, 4) + pygame.draw.rect(screen, RED, pygame.Rect(x + 210, y + 210, 100, 15), 0, 4) + + # texts + draw_text('Rycerze: 2', FONT_DARK, screen, x + 35, y + 240, 18) + draw_text('Fortece: 1', FONT_DARK, screen, x + 35, y + 270, 18) + + draw_text('Rycerze: 4', FONT_DARK, screen, x + 215, y + 240, 18) + draw_text('Fortece: 0', FONT_DARK, screen, x + 215, y + 270, 18) + + # points + pygame.draw.rect(screen, ORANGE, pygame.Rect(x, y + 390, 340, 3)) + draw_text('PUNKTY: 10', FONT_DARK, screen, x + 35, y + 408, 18, True) + draw_text('PUNKTY: 10', FONT_DARK, screen, x + 215, y + 408, 18, True) \ No newline at end of file