8000 commits · python019/python-game-projects@68d92a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 68d92a4

Browse files
committed
commits
1 parent eac5d43 commit 68d92a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1441
-404
lines changed

.DS_Store

0 Bytes
Binary file not shown.

LICENSE

Lines changed: 21 additions & 0 deletions
< F438 colgroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 RahulShagri
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 2 additions & 9 deletions

block_speeds_data.csv

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
level,speed
2+
0,15.974
3+
1,14.31
4+
2,12.646
5+
3,10.982
6+
4,9.318
7+
5,7.654
8+
6,5.99
9+
7,4.326
10+
8,2.662
11+
9,1.997
12+
10,1.664
13+
11,1.664
14+
12,1.664
15+
13,1.331
16+
14,1.331
17+
15,1.331
18+
16,0.998
19+
17,0.998
20+
18,0.998
21+
19,0.666
22+
20,0.666
23+
21,0.666
24+
22,0.666
25+
23,0.666
26+
24,0.666
27+
25,0.666
28+
26,0.666
29+
27,0.666
30+
28,0.666
31+
29,0.333

config.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Sets up all important config variables
2+
import dearpygui.dearpygui as dpg
3+
4+
# Set up all IDs required by items in Dear PyGui
5+
item_id = {
6+
"windows": {
7+
"main_window": dpg.generate_uuid(),
8+
"score_window": dpg.generate_uuid(),
9+
"tetris_board": dpg.generate_uuid(),
10+
"next_block_board": dpg.generate_uuid(),
11+
"statistics_window": dpg.generate_uuid(),
12+
},
13+
"displays": {
14+
"enter_level": dpg.generate_uuid(),
15+
"level_text": dpg.generate_uuid(),
16+
"full_line_text": dpg.generate_uuid(),
17+
"score_text": dpg.generate_uuid(),
18+
"I_block_stat": dpg.generate_uuid(),
19+
"J_block_stat": dpg.generate_uuid(),
20+
"L_block_stat": dpg.generate_uuid(),
21+
"O_block_stat": dpg.generate_uuid(),
22+
"S_block_stat": dpg.generate_uuid(),
23+
"T_block_stat": dpg.generate_uuid(),
24+
"Z_block_stat": dpg.generate_uuid(),
25+
"Total_block_stat": dpg.generate_uuid(),
26+
},
27+
"registries": {
28+
"texture_registry": dpg.generate_uuid(),
29+
"key_release_handler": dpg.generate_uuid(),
30+
"mouse_release_handler": dpg.generate_uuid(),
31+
},
32+
"buttons": {
33+
"play_button": dpg.generate_uuid(),
34+
},
35+
"block_texture": {
36+
"I_block": dpg.generate_uuid(),
37+
"J_block": dpg.generate_uuid(),
38+
"L_block": dpg.generate_uuid(),
39+
"O_block": dpg.generate_uuid(),
40+
"S_block": dpg.generate_uuid(),
41+
"T_block": dpg.generate_uuid(),
42+
"Z_block": dpg.generate_uuid(),
43+
},
44+
"blocks": {
45+
},
46+
}
47+
48+
# Names of all blocks
49+
block_names = ["I", "J", "L", "O", "S", "T", "Z"]
50+
51+
# Set up lists to track walls and cells occupied
52+
cell_boundary1 = [[n, -1] for n in range(10)] # Bottom Wall
53+
cell_boundary2 = [[10, n] for n in range(20)] # Right Wall
54+
cell_boundary3 = [[n, 20] for n in range(10)] # Top Wall
55+
cell_boundary4 = [[-1, n] for n in range(20)] # Left Wall
56+
57+
cell_boundary = cell_boundary1 + cell_boundary2 + cell_boundary3 + cell_boundary4 # All points in all walls combined
58+
cells_occupied = [] # List of all cells occupied by tetris blocks
59+
60+
# List of all block numbers active on the tetris board
61+
block_numbers = []
62+
63+
# Count of blocks created
64+
block_count = 0
65+
66+
# Flag to check if the last block is moving or not. 0=Stationary, 1-7=Corresponding type of block in motion
67+
block_moving_flag = 0
68+
69+
# Keep track of level and corresponding speed
70+
level = 0
71+
speed = 0
72+
73+
# Keep track of full lines completed
74+
full_lines = 0
75+
76+
# Keep track of score
77+
score = 0

data/.DS_Store

-6 KB
Binary file not shown.

data/Highscore.txt

Whitespace-only changes.

data/audios/.DS_Store

-6 KB
Binary file not shown.

data/audios/Crash.mp3

-64.4 KB
Binary file not shown.

data/audios/game.mp3

-7.56 MB
Binary file not shown.

data/audios/rtn.mp3

-4.21 MB
Binary file not shown.

data/images/.DS_Store

-6 KB
Binary file not shown.

data/images/Background.png

-1.91 MB
Binary file not shown.

data/images/Car.png

-63.9 KB
Binary file not shown.

data/images/Coming Cars/CC1.png

-24.8 KB
Binary file not shown.

data/images/Coming Cars/CC2.png

-22.8 KB
Binary file not shown.

data/images/Coming Cars/CC3.png

-18.1 KB
Binary file not shown.

data/images/Coming Cars/CC4.png

-14 KB
Binary file not shown.

data/images/Coming Cars/CC5.png

-13.9 KB
Binary file not shown.

data/images/Coming Cars/CC6.png

-13.2 KB
Binary file not shown.

data/images/Coming Cars/CC7.png

-14.1 KB
Binary file not shown.

data/images/Coming Cars/CC8.png

-26.7 KB
Binary file not shown.

data/images/Coming Cars/CC9.png

-24.5 KB
Binary file not shown.

data/images/Explosion.png

-40.7 KB
Binary file not shown.

data/images/Fuel.png

-24.4 KB
Binary file not shown.

data/images/GameOver.png

-2.13 MB
Binary file not shown.

data/images/Going Cars/GC1.png

-24.5 KB
Binary file not shown.

data/images/Going Cars/GC2.png

-22.2 KB
Binary file not shown.

data/images/Going Cars/GC3.png

-18.1 KB
Binary file not shown.

data/images/Going Cars/GC4.png

-14.2 KB
Binary file not shown.

data/images/Going Cars/GC5.png

-14.3 KB
Binary file not shown.

data/images/Going Cars/GC6.png

-13.2 KB
Binary file not shown.

data/images/Going Cars/GC7.png

-14.3 KB
Binary file not shown.

data/images/Going Cars/GC8.png

-26.2 KB
Binary file not shown.

data/images/Going Cars/GC9.png

-24.2 KB
Binary file not shown.

data/images/LeftDisplay.png

-13.7 KB
Binary file not shown.

data/images/RightDisplay.png

-13 KB
Binary file not shown.

data/images/Road.png

-3.9 MB
Binary file not shown.

data/images/Sand.jpg

-147 KB
Binary file not shown.

data/images/Strip.png

-282 Bytes
Binary file not shown.

data/images/Tree.png

-92.5 KB
Binary file not shown.

fonts/PressStart2P-vaV7.ttf

80.5 KB
Binary file not shown.

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dearpygui==1.0.2
2+
pandas==1.3.4
3+
playsound2==0.1

resources/tetris.png

216 KB

sounds/clear.wav

14.7 KB
Binary file not shown.

sounds/fall.wav

7.6 KB
Binary file not shown.

sounds/gameover.wav

94.2 KB
Binary file not shown.

sounds/line.wav

6.1 KB
Binary file not shown.

sounds/selection.wav

14.2 KB
Binary file not shown.

sounds/success.wav

37.4 KB
Binary file not shown.

sounds/theme.mp3

1.28 MB
Binary file not shown.

0 commit comments

Comments
 (0)
0