Skip to content

Commit

Permalink
Release 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YariKartoshe4ka committed Jun 1, 2022
2 parents 6b3fe7b + de51e61 commit e42a689
Show file tree
Hide file tree
Showing 58 changed files with 1,084 additions and 326 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: pip install -r requirements.txt pytest pytest-cov pytest-xdist[psutil] pytest-timeout
run: pip install -r requirements.txt -r tests/requirements.txt
- name: Run tests
run: python -m pytest -n auto --cov spaceway --cov-report xml --color=yes tests/
run: python -m pytest -n auto --cov spaceway --cov tests --cov-report xml --color=yes tests/
env:
SDL_VIDEODRIVER: dummy
SDL_AUDIODRIVER: disk
- name: Upload coverage
uses: codecov/codecov-action@v2
16 changes: 12 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Python environment
venv
__pycache__
*.pyc
other

# Android
bin
.buildozer

# Test data
.coverage
.cProfile

# Build and other
build
dist
*.egg-info
.coverage
bin
.buildozer
other
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Arcade game about space, in which you must overcome the space path by flying around obstacles

![](https://img.shields.io/pypi/v/spaceway) ![](https://img.shields.io/github/release-date/YariKartoshe4ka/Space-Way) ![](https://img.shields.io/pypi/dm/spaceway) <br>
![](https://img.shields.io/codecov/c/github/YariKartoshe4ka/Space-Way) ![](https://img.shields.io/github/issues-raw/YariKartoshe4ka/Space-Way/help%20wanted)
![](https://codecov.io/gh/YariKartoshe4ka/Space-Way/branch/develop/graph/badge.svg?token=PQGAWK18ZN) ![](https://img.shields.io/github/issues-raw/YariKartoshe4ka/Space-Way/help%20wanted)

<img src="https://raw.githubusercontent.com/YariKartoshe4ka/Space-Way/master/docs/icons/icon_fit.svg" width=128 />

Expand Down Expand Up @@ -41,11 +41,16 @@ spaceway
I am not a professional game developer (this is my first game), and I do not know if it makes sense to develop it, but if there is activity on the repository, then I'm going to do:

1. Music and sprites update
2. Add more obstacles for different levels of difficulty
2. Add more obstacles

[and many other things...](https://github.com/YariKartoshe4ka/Space-Way/blob/master/docs/TODO.md)


### Thanks to

- [Arthur Karimullin](https://github.com/KarimullinArthur) for his original and wonderful 8-bit sounds


### Contribution

If you want to contribute to this repo, check out [TODO.md](https://github.com/YariKartoshe4ka/Space-Way/blob/master/docs/TODO.md) and check out what you can do<br>
Expand Down
6 changes: 5 additions & 1 deletion docs/CODESTYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ Now project has this structure:

```sh
|____ __init__.py
|____ boost.py
|____ collection.py
|____ config.py
|____ debug.py
|____ hitbox.py
|____ main.py
|____ mixins.py
|____ music.py
|____ updater.py
|____ assets
| |____ <fonts, sprites, sounds and other binary files...>
Expand All @@ -29,13 +31,15 @@ Now project has this structure:
```

General files:
- *\_\_init__.py* - default file for python modules. Checks version of Python and prints exception if it less than 3.6.0
- *\_\_init__.py* - default file for python modules. Checks version of Python and prints exception if it less than 3.6.0
- *boost.py* - file with implementation of various utility functions
- *collection.py* - file with the implementation of additional data structures, mainly the *pygame.sprite.Group* extensions
- *config.py* - file with some objects for easier configuration management
- *debug.py* - file with some objects for easier debugging game
- *hitbox.py* - file with implementation of hitboxes for some objects calculations
- *main.py* - main file, import all modules, contains the entrypoint of game and connects all the scenes together
- *mixins.py* - file with mixins which are needed for simple creation of the same type of objects (DRY principle)
- *music.py* - file with some objects for easier music (sounds) management
- *updater.py* - file responsible for updating Space Way

Assets:
Expand Down
2 changes: 1 addition & 1 deletion docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

- Gameplay improvements
- Add global score table
- Add more obstacles for different levels of difficulty (need ideas and sprite artist)
- Add more obstacles (need ideas and sprite artist)

- Cross-platform
- Add shortcut on Mac OS (needs maintainer)
Binary file modified docs/screenshots/end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/lobby.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pygame==2.0.3
packaging==20.4
requests==2.24.0
platformdirs==2.1.0
pygame==2.1.2
packaging>=20.4
requests>=2.24.0
platformdirs>=2.1.0
psutil>=5.5.1
Binary file modified spaceway/assets/images/background/headpiece.bmp
Binary file not shown.
Binary file not shown.
Binary file removed spaceway/assets/images/buttons/difficulty_middle.bmp
Binary file not shown.
Binary file not shown.
Binary file added spaceway/assets/images/buttons/effects_100.bmp
Binary file not shown.
Binary file added spaceway/assets/images/buttons/effects_25.bmp
Binary file not shown.
Binary file added spaceway/assets/images/buttons/effects_50.bmp
Binary file not shown.
Binary file added spaceway/assets/images/buttons/effects_75.bmp
Binary file not shown.
Binary file removed spaceway/assets/images/buttons/effects_false.bmp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added spaceway/assets/images/buttons/music_25.bmp
Binary file not shown.
Binary file added spaceway/assets/images/buttons/music_50.bmp
Binary file not shown.
Binary file added spaceway/assets/images/buttons/music_75.bmp
Binary file not shown.
Binary file added spaceway/assets/images/inputs/nick_wrong.bmp
Binary file not shown.
Binary file added spaceway/assets/sounds/bang.ogg
Binary file not shown.
Binary file removed spaceway/assets/sounds/bang.wav
Binary file not shown.
Binary file added spaceway/assets/sounds/game.ogg
Binary file not shown.
Binary file removed spaceway/assets/sounds/jump.wav
Binary file not shown.
Binary file added spaceway/assets/sounds/score.ogg
Binary file not shown.
Binary file removed spaceway/assets/sounds/score.wav
Binary file not shown.
70 changes: 70 additions & 0 deletions spaceway/boost.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
""" File with implementation of various utility functions """

from functools import lru_cache

import pygame


@lru_cache(maxsize=4)
def _circle_points(r):
"""Descretization of a circle into a list of points
Args:
r (int): Circle radius
Returns:
List[Tuple[int, int]]: List of points representing a circle with
given radius
"""
x, y, e = r, 0, 1 - r

points = []

while x >= y:
points.append((x, y))

y += 1
if e < 0:
e += 2 * y - 1
else:
x -= 1
e += 2 * (y - x) - 1

points += [(y, x) for x, y in points if x > y]
points += [(-x, y) for x, y in points if x]
points += [(x, -y) for x, y in points if y]

return points


def render(font, text, color, border=0, bcolor=None):
"""Analog of the :method:`pygame.font.Font.render` with support of a
border around the font
Args:
font (pygame.font.Font): Font object
text (str): The text you need to render
color (pygame.Color): Text color
border (int): Border width
bcolor (pygame.Color): Border color
Returns:
pygame.Surface: Rendered text
"""
text_surface = font.render(text, True, color).convert_alpha()
w = text_surface.get_width() + 2 * border
h = font.get_height() + 2 * border

osurf = pygame.Surface((w, h)).convert_alpha()
osurf.fill((0, 0, 0, 0))

surf = osurf.copy()

osurf.blit(font.render(text, True, bcolor).convert_alpha(), (0, 0))

for dx, dy in _circle_points(border):
surf.blit(osurf, (dx + border, dy + border))

surf.blit(text_surface, (border, border))

return surf
4 changes: 2 additions & 2 deletions spaceway/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def activate(self, boost) -> None:
boost.number_in_queue = len(self.active) + 1

if self.active.get(boost.name):
# If boost has already activated, zeroize its life time
self.active[boost.name].tick = 0
# If boost has already activated, reset its life time
self.active[boost.name].life = boost.life
self.remove_internal(boost)
else:
# If boost has not activated yet, move it from passive
Expand Down
8 changes: 6 additions & 2 deletions spaceway/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ def __load(self) -> None:
with open(self.PATH_MAIN_CONFIG) as file:
config: dict = load(file)

# Mount user configuration to 'user' section of dictionary
with open(self.PATH_USER_CONFIG) as file:
# Mount original user configuration (for compatibility between updates)
with open(self.__ORIGINAL_PATH_USER_CONFIG) as file:
config['user'] = load(file)

# Update user configuration with an existing one
with open(self.PATH_USER_CONFIG) as file:
config['user'].update(load(file))

# Initializing `list` for scores of attempts
config['score_list'] = list()

Expand Down
2 changes: 1 addition & 1 deletion spaceway/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"FPS": 60,
"scene": "headpiece",
"sub_scene": "headpiece",
"version": "2.2.0",
"version": "2.3.0",
"debug": false
}
4 changes: 2 additions & 2 deletions spaceway/config/user.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"nick": "your nick here",
"effects": true,
"effects": 1,
"music": 1,
"full_screen": false,
"updates": true,
"difficulty": 0,
"color": 0
}
Loading

0 comments on commit e42a689

Please sign in to comment.