Skip to content

Commit d8ab8c4

Browse files
committed
Add default project configs
1 parent aea7fe3 commit d8ab8c4

15 files changed

+255
-28
lines changed

.gitignore

+108-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,111 @@
1-
# python
2-
*.pyc
3-
__pycache__
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
58+
# Flask stuff:
59+
instance/
60+
.webassets-cache
61+
62+
# Scrapy stuff:
63+
.scrapy
64+
65+
# Sphinx documentation
66+
docs/_build/
67+
68+
# PyBuilder
69+
target/
70+
71+
# Jupyter Notebook
72+
.ipynb_checkpoints
73+
74+
# pyenv
75+
.python-version
76+
77+
# celery beat schedule file
78+
celerybeat-schedule
79+
80+
# SageMath parsed files
81+
*.sage.py
82+
83+
# dotenv
84+
.env
85+
86+
# virtualenv
87+
.venv
488
venv/
89+
ENV/
590

6-
# other
7-
data
8-
TODO
91+
# Spyder project settings
92+
.spyderproject
93+
.spyproject
994

10-
# ctags
11-
tags
12-
tags.lock
13-
tags.temp
95+
# Rope project settings
96+
.ropeproject
97+
98+
# mkdocs documentation
99+
/site
100+
101+
# mypy
102+
.mypy_cache/
103+
104+
# IDE settings
105+
.vscode/
106+
.idea/
107+
108+
# TMP
109+
assets/
110+
data/
111+
TODO
-33.5 KB
Binary file not shown.

pyproject.toml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
[tool.pytest]
2+
testpaths = "tests"
3+
4+
[tool.coverage.run]
5+
branch = true
6+
source = ["src"]
7+
omit = ["tests/*"]
8+
9+
[tool.coverage.report]
10+
show_missing = true
11+
fail_under = 75
12+
exclude_lines = [
13+
"pragma: no cover",
14+
"def __repr__",
15+
"if self.debug:",
16+
"if settings.DEBUG",
17+
"raise AssertionError",
18+
"raise NotImplementedError",
19+
"if 0:",
20+
"if False:",
21+
"if __name__ == .__main__.:",
22+
]
23+
24+
[tool.tox]
25+
legacy_tox_ini = """
26+
[tox]
27+
envlist = py39,py310
28+
29+
[testenv]
30+
deps =
31+
pytest >= 7,<8
32+
coverage[toml] >= 6,<7
33+
commands =
34+
coverage run -m pytest
35+
coverage report
36+
37+
[testenv:flake8]
38+
deps =
39+
flake8 >= 4,<5
40+
commands =
41+
flake8
42+
"""
43+
44+
[tool.pylint.MASTER]
45+
ignore-paths= ["tests/*"]
46+
47+
[tool.pylint.FORMAT]
48+
max-line-length = 88
49+
disable = ["R0903", "R0913", "C0103", "C0114", "C0115", "C0116", "C0411"]
50+
51+
[tool.isort]
52+
skip_glob = "venv/*"
53+
profile = "black"
54+
55+
[tool.mypy]
56+
exclude = "tests"
57+
strict = false
58+
# Disallow dynamic typing
59+
# Disallows usage of types that come from unfollowed imports
60+
# (anything imported from an unfollowed import is automatically
61+
# given a type of Any).
62+
disallow_any_unimported = false
63+
# Disallows all expressions in the module that have type Any.
64+
disallow_any_expr = false
65+
# Disallows functions that have Any in their signature
66+
# after decorator transformation.
67+
disallow_any_decorated = false
68+
# Disallows explicit Any in type positions such as type
69+
# annotations and generic type parameters.
70+
disallow_any_explicit = false
71+
# Disallows usage of generic types that do not specify
72+
# explicit type parameters.
73+
disallow_any_generics = true
74+
# Disallows subclassing a value of type Any.
75+
disallow_subclassing_any = true
76+
77+
# Untyped definitions and calls
78+
# Disallows calling functions without type annotations
79+
# from functions with type annotations.
80+
disallow_untyped_calls = false
81+
82+
# Disallows defining functions without type annotations
83+
# or with incomplete type annotations.
84+
disallow_untyped_defs = true
85+
# Disallows defining functions with incomplete type annotations.
86+
disallow_incomplete_defs = true
87+
# Type-checks the interior of functions without type annotations.
88+
check_untyped_defs = true
89+
# Reports an error whenever a function with type annotations is
90+
# decorated with a decorator without annotations.
91+
disallow_untyped_decorators = true
92+
93+
# None and Optional handling
94+
# Changes the treatment of arguments with a default value
95+
# of None by not implicitly making their type Optional.
96+
no_implicit_optional = true
97+
# Enables or disables strict Optional checks. If False,
98+
# mypy treats None as compatible with every type.
99+
strict_optional = false
100+
101+
# Configuring warnings
102+
# Warns about casting an expression to its inferred type.
103+
warn_redundant_casts = true
104+
# Warns about unneeded # type: ignore comments.
105+
warn_unused_ignores = true
106+
# Shows errors for missing return statements on some execution paths.
107+
warn_no_return = true
108+
# Shows a warning when returning a value with type Any from a function
109+
# declared with a non- Any return type.
110+
warn_return_any = true
111+
# Shows a warning when encountering any code inferred to be unreachable
112+
# or redundant after performing type analysis.
113+
warn_unreachable = true
114+
115+
# Import discovery
116+
# Suppresses error messages about imports that cannot be resolved.
117+
ignore_missing_imports = true

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
numpy=>1.21
2+
pygame>=2.0
3+
triangle==20200424

setup.cfg

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# These dependencies will only be installed
2+
# if you ask for them, e.g. pip install -e ".[dev]".
3+
[options.extras_require]
4+
dev =
5+
flake8>=4,<5
6+
mypy>=0.950,<1
7+
tox>=3,<4
8+
9+
[flake8]
10+
exclude = .git, .eggs, __pycache__, docs/, build/, dist/, venv/, .mypy_cache, .pytest_cache, instance/
11+
max-line-length=88
File renamed without changes.

config.py src/config.py

File renamed without changes.

enemy.py src/enemy.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
class Enemy(Animation):
1313

14+
scale = 4
1415
speed = 2
1516

1617
# Define the single movement states.
@@ -61,8 +62,8 @@ def __init__(self, _game, _x, _y):
6162
image, _ = load_image(
6263
path + img, alpha=True, path=False)
6364
_images.append(pg.transform.scale(
64-
image, (image.get_rect().width//3,
65-
image.get_rect().height//3)))
65+
image, (image.get_rect().width // self.scale,
66+
image.get_rect().height // self.scale)))
6667
self.images.append(_images)
6768
else:
6869
print('warn: Directory ' + directory + ' doesnt exists.')

flashlight.py src/flashlight.py

File renamed without changes.

main.py src/main.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ def __init__(self):
6666
# A sprite group that contains all room sprites..
6767
self.room_sprites = pg.sprite.RenderPlain(
6868
self.create_rooms()
69-
# Room(100, 100, 800, 600, self.get_offset(),
70-
# _doors=('right', 'left')),
71-
# Room(-400, -100, 500, 1000, self.get_offset(),
72-
# _doors=('bottom', 'right')),
73-
# Room(-400, 900, 500, 250, self.get_offset(), _doors=('top')),
74-
# Room(900, 200, 600, 400, self.get_offset(), _doors=('left')),
7569
)
7670

7771
# A sprite group that contains all wall and block sprites.
@@ -85,7 +79,7 @@ def __init__(self):
8579
self.navmesh = NavMesh(self)
8680

8781
self.enemy_sprites = pg.sprite.RenderPlain(
88-
# Enemy(self, 1150, 400),
82+
Enemy(self, 100, 100),
8983
)
9084
# A sprite group that contains all close room sprites (render only).
9185
self.room_render_sprites = pg.sprite.RenderPlain()

navmesh.py src/navmesh.py

File renamed without changes.

player.py src/player.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
class Player(Animation):
1616

17+
scale = 4
1718
speed = 6
1819

1920
# Define the single movement states.
@@ -69,8 +70,8 @@ def __init__(self, _game, _x, _y):
6970
image, _ = load_image(
7071
path + img, alpha=True, path=False)
7172
_images.append(pg.transform.scale(
72-
image, (image.get_rect().width//3,
73-
image.get_rect().height//3)))
73+
image, (image.get_rect().width // self.scale,
74+
image.get_rect().height // self.scale)))
7475
self.images.append(_images)
7576
else:
7677
print('warn: Directory ' + directory + ' doesnt exists.')
@@ -341,7 +342,7 @@ def get_weapon_angle(self):
341342
self.get_aim_x() - self.get_virt_weapon_x())
342343
+ 2 * math.pi) % (2 * math.pi)
343344

344-
def get_weapon_x(self, offset1=17, offset2=40):
345+
def get_weapon_x(self, offset1=13, offset2=15):
345346
"""
346347
Get the real x coordinate of the weapon in the game world.
347348
"""
@@ -350,7 +351,7 @@ def get_weapon_x(self, offset1=17, offset2=40):
350351
- math.cos(angle - math.pi/2) * offset1
351352
+ math.cos(angle) * offset2)
352353

353-
def get_weapon_y(self, offset1=17, offset2=40):
354+
def get_weapon_y(self, offset1=13, offset2=15):
354355
"""
355356
Get the real y coordinate of the weapon in the game world.
356357
"""
@@ -359,7 +360,7 @@ def get_weapon_y(self, offset1=17, offset2=40):
359360
- math.sin(angle - math.pi/2) * offset1
360361
+ math.sin(angle) * offset2)
361362

362-
def get_virt_weapon_x(self, offset1=17, offset2=40):
363+
def get_virt_weapon_x(self, offset1=13, offset2=15):
363364
"""
364365
Get the virtual x coordinate of weapon on the screen.
365366
"""
@@ -368,7 +369,7 @@ def get_virt_weapon_x(self, offset1=17, offset2=40):
368369
- math.cos(angle - math.pi/2) * offset1
369370
+ math.cos(angle) * offset2)
370371

371-
def get_virt_weapon_y(self, offset1=17, offset2=40):
372+
def get_virt_weapon_y(self, offset1=13, offset2=15):
372373
"""
373374
Get the virtual y coordinate of weapon on the screen.
374375
"""
@@ -384,8 +385,10 @@ class PlayerFeet(Animation):
384385
A player subclass to hold the feet images / states of the player.
385386
"""
386387

388+
scale = 5
389+
387390
# @workaroung: offset (20) for rifle, shutgun and knife
388-
feet_offset_px = 10
391+
feet_offset_px = 5
389392

390393
feet_index = 0
391394
feets = [
@@ -410,8 +413,8 @@ def __init__(self, _player):
410413
image, _ = load_image(
411414
path + img, alpha=True, path=False)
412415
_images.append(pg.transform.scale(
413-
image, (image.get_rect().width//3,
414-
image.get_rect().height//3)))
416+
image, (image.get_rect().width // self.scale,
417+
image.get_rect().height // self.scale)))
415418
self.images.append(_images)
416419
else:
417420
print('warn: Directory ' + directory + ' doesnt exists.')

room.py src/room.py

File renamed without changes.

spritesheet.py src/spritesheet.py

File renamed without changes.

utils.py src/utils.py

File renamed without changes.

0 commit comments

Comments
 (0)