Skip to content

Commit

Permalink
Merge pull request #1 from SamuelPerzel/SamuelPerzel-graphics-and-OOP…
Browse files Browse the repository at this point in the history
…-rewrite

Redesign and rewrite the code to OOP
  • Loading branch information
SamuelPerzel authored Apr 14, 2022
2 parents 12eabb1 + 4071e86 commit c84889d
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 166 deletions.
48 changes: 32 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
# Push the Box
* by: Samuel peržeľ
#### by: Samuel Peržeľ

This is a small game that was created as a school project.
It is done in Python using tkinter library.
## Basic Information
This is a small game, that was made as a school project.
The game is done entirely in python, using the tkinter library.
I have also added a config file to determine the **WIDTH** and **HEIGHT** or variables such as **TILE_SIZE**.

The code might feel a bit messy, since I am not used to publishing it, but I thought I might give it a try.
## Game Mechanics
The goal of the game is to get the blue box to the win location.
The main obstacles are walls, which neither you, nor the box can move through.
There is a possibility, that the box will get stuck (for example you get it to a corner).
In this case, you have the ability to restart the level, which will return both the player and the box to their starting position.

Point of the game is to move the blue box to a specific location. After this condition is met, you win the game.
Currently, the game contains only one level. It will probably stay this way, but if I'll have the time, I might do couple of more levels going from trivial to harder ones.
I was even thinking about some other mechanics such as portals, or that the reset will only apply for player and you can use that to your advantage, but those are just some ideas.
I might even make some textures so the game does not look so bland.
## Controls
- WASD --> movement
- R --> reset the level

CONTROLS:
* WASD - movement
* R - restart
## Tile Explanation
### Wall
![wall](https://user-images.githubusercontent.com/47799881/163355703-421b3824-e15d-4b5b-b180-915d66ebda9c.png)

TILES INFO:
* red -> player
* blue -> box
* green -> win location
* grey -> wall
### Player - neutral position
![player_neutral](https://user-images.githubusercontent.com/47799881/163353619-51493de2-4b20-4b0f-9fb1-dd11594bee5c.png)

### Player - after moving
![player_up](https://user-images.githubusercontent.com/47799881/163354941-2298d3b4-262d-463f-b570-5a5238c194bb.png)
![player_left](https://user-images.githubusercontent.com/47799881/163354965-a2456613-c113-456c-a40a-cbc93407a0e4.png)
![player_down](https://user-images.githubusercontent.com/47799881/163354982-85d16bf1-1377-4091-96c4-7d45acf6a1d6.png)
![player_right](https://user-images.githubusercontent.com/47799881/163354979-9c6311d2-063b-4d11-bb27-23d4fd8bec71.png)

### Box - before and after winning
![box](https://user-images.githubusercontent.com/47799881/163355221-7390e02f-5704-4f8e-8b2e-b1e5d09cb2c7.png)
![box_win](https://user-images.githubusercontent.com/47799881/163355565-6026680b-9165-4a85-8676-9095416e83f0.png)

### Win Location - before and after winning
![win_location_off](https://user-images.githubusercontent.com/47799881/163355623-1cf228ac-4e0e-4676-b63d-77064cb2d659.png)
![win_location_on](https://user-images.githubusercontent.com/47799881/163356455-6bf09562-8ab5-45dc-b9bf-72f30a08f38d.png)
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WIDTH = 1280
HEIGHT = 720

PLAYER_SIZE = 20
TILE_SIZE = 40
TILE_SIZE = 40
PLAYER_SIZE = TILE_SIZE/2
26 changes: 15 additions & 11 deletions level.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
*##########
*#****#***#
*#****#*B*#
*#*#**#*#P#
*#*#*##**##
##*#******#
#**#*####*#
#*********#
#########*#
********#W#
********###
***************
***************
***##########**
***#****#***#**
***#****#*B*#**
***#*#**#*#P#**
***#*#*##**##**
**##*#******#**
**#**#*####*#**
**#*********#**
**#########*#**
**********#W#**
**********###**
***************
***************
299 changes: 162 additions & 137 deletions push the box.py

Large diffs are not rendered by default.

Binary file added textures/box.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 added textures/player_down.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 added textures/player_left.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 added textures/player_neutral.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 added textures/player_right.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 added textures/player_up.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 added textures/wall.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 added textures/win_location_off.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 added textures/win_location_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c84889d

Please sign in to comment.