summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-09-03 22:38:14 +0200
committerRaindropsSys <contact@minteck.org>2023-09-03 22:38:14 +0200
commit5a50cd93de8cb94154777e2da8f1bbca86479199 (patch)
tree74c427061e5f23bc709b8c976b1bf559666cc04e
parent153d21ace9801ac665e2d7f99c967147d1214f29 (diff)
downloadblocks-5a50cd93de8cb94154777e2da8f1bbca86479199.tar.gz
blocks-5a50cd93de8cb94154777e2da8f1bbca86479199.tar.bz2
blocks-5a50cd93de8cb94154777e2da8f1bbca86479199.zip
Updated 4 files and added 5 files (automated)
-rw-r--r--Icon 0
-rw-r--r--assets/sounds/game/block_cloth_1.oggbin0 -> 4832 bytes
-rw-r--r--assets/sounds/game/block_cloth_2.oggbin0 -> 4862 bytes
-rw-r--r--assets/sounds/game/block_cloth_3.oggbin0 -> 4897 bytes
-rw-r--r--assets/sounds/game/block_cloth_4.oggbin0 -> 4844 bytes
-rw-r--r--src/audio.py6
-rw-r--r--src/blocks.py96
-rw-r--r--src/game.py9
-rw-r--r--src/helper.py15
9 files changed, 121 insertions, 5 deletions
diff --git a/Icon b/Icon
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Icon
diff --git a/assets/sounds/game/block_cloth_1.ogg b/assets/sounds/game/block_cloth_1.ogg
new file mode 100644
index 0000000..0ea73f8
--- /dev/null
+++ b/assets/sounds/game/block_cloth_1.ogg
Binary files differ
diff --git a/assets/sounds/game/block_cloth_2.ogg b/assets/sounds/game/block_cloth_2.ogg
new file mode 100644
index 0000000..a607a9e
--- /dev/null
+++ b/assets/sounds/game/block_cloth_2.ogg
Binary files differ
diff --git a/assets/sounds/game/block_cloth_3.ogg b/assets/sounds/game/block_cloth_3.ogg
new file mode 100644
index 0000000..64b5ef9
--- /dev/null
+++ b/assets/sounds/game/block_cloth_3.ogg
Binary files differ
diff --git a/assets/sounds/game/block_cloth_4.ogg b/assets/sounds/game/block_cloth_4.ogg
new file mode 100644
index 0000000..b65ed79
--- /dev/null
+++ b/assets/sounds/game/block_cloth_4.ogg
Binary files differ
diff --git a/src/audio.py b/src/audio.py
index 169c886..46a3e4b 100644
--- a/src/audio.py
+++ b/src/audio.py
@@ -52,6 +52,12 @@ sfx = {
pygame.mixer.Sound("./assets/sounds/game/block_wood_3.ogg"),
pygame.mixer.Sound("./assets/sounds/game/block_wood_4.ogg")
],
+ "cloth": [
+ pygame.mixer.Sound("./assets/sounds/game/block_cloth_1.ogg"),
+ pygame.mixer.Sound("./assets/sounds/game/block_cloth_2.ogg"),
+ pygame.mixer.Sound("./assets/sounds/game/block_cloth_3.ogg"),
+ pygame.mixer.Sound("./assets/sounds/game/block_cloth_4.ogg")
+ ],
"none": [
pygame.mixer.Sound("./assets/sounds/game/none_1.ogg"),
pygame.mixer.Sound("./assets/sounds/game/none_2.ogg"),
diff --git a/src/blocks.py b/src/blocks.py
index b534e6b..4ebd66b 100644
--- a/src/blocks.py
+++ b/src/blocks.py
@@ -22,5 +22,101 @@ blocks = {
"sounds": ("stone", "stone"),
"placeable": False,
"name": "Bedrock"
+ },
+ "white_wool": {
+ "texture": 28,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "White Wool"
+ },
+ "light_gray_wool": {
+ "texture": 27,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Light Gray Wool"
+ },
+ "gray_wool": {
+ "texture": 26,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Gray Wool"
+ },
+ "black_wool": {
+ "texture": 25,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Black Wool"
+ },
+ "brown_wool": {
+ "texture": 29,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Brown Wool"
+ },
+ "red_wool": {
+ "texture": 14,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Red Wool"
+ },
+ "orange_wool": {
+ "texture": 15,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Orange Wool"
+ },
+ "yellow_wool": {
+ "texture": 16,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Yellow Wool"
+ },
+ "lime_wool": {
+ "texture": 17,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Lime Wool"
+ },
+ "green_wool": {
+ "texture": 18,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Green Wool"
+ },
+ "cyan_wool": {
+ "texture": 19,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Cyan Wool"
+ },
+ "light_blue_wool": {
+ "texture": 20,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Light Blue Wool"
+ },
+ "blue_wool": {
+ "texture": 21,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Blue Wool"
+ },
+ "purple_wool": {
+ "texture": 22,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Purple Wool"
+ },
+ "magenta_wool": {
+ "texture": 23,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Magenta Wool"
+ },
+ "pink_wool": {
+ "texture": 24,
+ "sounds": ("cloth", "cloth"),
+ "placeable": True,
+ "name": "Pink Wool"
}
} \ No newline at end of file
diff --git a/src/game.py b/src/game.py
index 82330b7..611d5b1 100644
--- a/src/game.py
+++ b/src/game.py
@@ -106,6 +106,15 @@ def run(screen, save_data):
audio.play_sfx(block_list[selected_block]['sounds'][0])
chunk[screen_blocks[i][3] + 1][screen_blocks[i][6]][screen_blocks[i][7]] = selected_block
need_update_world = True
+ else:
+ print("Cannot place block at " + str(screen_blocks[i][6]) + ", " + str(screen_blocks[i][3] + 1) + ", " + str(screen_blocks[i][7]))
+
+ if not (len(chunk) - 1 >= screen_blocks[i][3] + 1):
+ print(" => No layer available")
+ elif not (chunk[screen_blocks[i][3] + 1][screen_blocks[i][7]][screen_blocks[i][6]] == "air"):
+ print(" => Above layer obstructed, has " + chunk[screen_blocks[i][3] + 1][screen_blocks[i][7]][screen_blocks[i][6]])
+ elif not (chunk[screen_blocks[i][3] + 1][screen_blocks[i][6]][screen_blocks[i][7]] != selected_block):
+ print(" => No change to make")
break
elif right:
diff --git a/src/helper.py b/src/helper.py
index 2f4e53e..c9a77db 100644
--- a/src/helper.py
+++ b/src/helper.py
@@ -45,12 +45,17 @@ def get_block_texture(block):
return blocks[block]['texture']
def draw_texture(id):
- if id < 10:
- pos = (42 * id, 0)
- else:
- pos = (42 * (id - (floor(((id + 1) / 10) - 1) * 10)), 42 * (floor(((id + 1) / 10) - 1)))
+ x = 0
+ y = 0
+
+ for i in range(id):
+ x += 42
+
+ if x >= 420:
+ x = 0
+ y += 42
- return texture_map.subsurface((pos[0], pos[1], 42, 42))
+ return texture_map.subsurface((x, y, 42, 42))
def draw_control(id):
if id < 10: