Rycerz istnieje
152
.gitignore
vendored
Normal file
@ -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/
|
6
colors.py
Normal file
@ -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)
|
22
constants.py
Normal file
@ -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',
|
||||||
|
]
|
4
field.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class Field:
|
||||||
|
def __init__(self, texture_path, converted_texture):
|
||||||
|
self.texture_path = texture_path
|
||||||
|
self.converted_texture = converted_texture
|
136
game.py
Normal file
@ -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)
|
35
grid.py
Normal file
@ -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)
|
12
helpers.py
Normal file
@ -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)
|
19
knight.py
Normal file
@ -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()
|
||||||
|
|
||||||
|
|
25
logs.py
Normal file
@ -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)
|
5
main.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from game import Game
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
game = Game()
|
||||||
|
game.main_menu()
|
BIN
requirements.txt
Normal file
93
resources/fonts/OFL.txt
Normal file
@ -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.
|
BIN
resources/fonts/Poppins-Black.ttf
Normal file
BIN
resources/fonts/Poppins-BlackItalic.ttf
Normal file
BIN
resources/fonts/Poppins-Bold.ttf
Normal file
BIN
resources/fonts/Poppins-BoldItalic.ttf
Normal file
BIN
resources/fonts/Poppins-ExtraBold.ttf
Normal file
BIN
resources/fonts/Poppins-ExtraBoldItalic.ttf
Normal file
BIN
resources/fonts/Poppins-ExtraLight.ttf
Normal file
BIN
resources/fonts/Poppins-ExtraLightItalic.ttf
Normal file
BIN
resources/fonts/Poppins-Italic.ttf
Normal file
BIN
resources/fonts/Poppins-Light.ttf
Normal file
BIN
resources/fonts/Poppins-LightItalic.ttf
Normal file
BIN
resources/fonts/Poppins-Medium.ttf
Normal file
BIN
resources/fonts/Poppins-MediumItalic.ttf
Normal file
BIN
resources/fonts/Poppins-Regular.ttf
Normal file
BIN
resources/fonts/Poppins-SemiBold.ttf
Normal file
BIN
resources/fonts/Poppins-SemiBoldItalic.ttf
Normal file
BIN
resources/fonts/Poppins-Thin.ttf
Normal file
BIN
resources/fonts/Poppins-ThinItalic.ttf
Normal file
BIN
resources/icons/sword.png
Normal file
After Width: | Height: | Size: 17 KiB |
45
resources/textures/License free.txt
Normal file
@ -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:
|
||||||
|
<a href="http://www.freepik.com">Designed by vectorpocket / Freepik</a>
|
||||||
|
|
||||||
|
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.
|
30
resources/textures/License premium.txt
Normal file
@ -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.
|
BIN
resources/textures/bg.jpg
Normal file
After Width: | Height: | Size: 256 KiB |
19
resources/textures/data.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
........................
|
||||||
|
.P......................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
||||||
|
........................
|
BIN
resources/textures/grass1.png
Normal file
After Width: | Height: | Size: 814 B |
BIN
resources/textures/grass2.png
Normal file
After Width: | Height: | Size: 820 B |
BIN
resources/textures/grass3.png
Normal file
After Width: | Height: | Size: 789 B |
BIN
resources/textures/grass4.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
resources/textures/grass5.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/textures/grass6.png
Normal file
After Width: | Height: | Size: 969 B |
BIN
resources/textures/grass_with_tree.jpg
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
resources/textures/knight.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
resources/textures/sand.png
Normal file
After Width: | Height: | Size: 760 B |
BIN
resources/textures/shield_blue.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
resources/textures/shield_red.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
resources/textures/t1.jpeg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
resources/textures/t10.jpg
Normal file
After Width: | Height: | Size: 87 KiB |
BIN
resources/textures/t2.jpg
Normal file
After Width: | Height: | Size: 218 KiB |
BIN
resources/textures/t3.jpg
Normal file
After Width: | Height: | Size: 161 KiB |
BIN
resources/textures/t4.jpg
Normal file
After Width: | Height: | Size: 381 KiB |
BIN
resources/textures/t5.jpg
Normal file
After Width: | Height: | Size: 470 KiB |
BIN
resources/textures/t6.jpg
Normal file
After Width: | Height: | Size: 1.7 MiB |
BIN
resources/textures/t7.jpg
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
resources/textures/t8.jpg
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
resources/textures/t9.jpg
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
resources/textures/tree1.png
Normal file
After Width: | Height: | Size: 1019 B |
BIN
resources/textures/tree2.png
Normal file
After Width: | Height: | Size: 810 B |
BIN
resources/textures/water.png
Normal file
After Width: | Height: | Size: 725 B |
44
stats.py
Normal file
@ -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)
|