fix issue with block placement

This commit is contained in:
2025-01-31 20:14:48 +08:00
parent e2cdd2e4e5
commit 3cb2bf4b74
3 changed files with 23 additions and 9 deletions

View File

@@ -52,3 +52,13 @@ class AirBlock(Block):
def __init__(self, x: int, y: int):
super().__init__(x, y)
class WaterBlock(Block):
id = 'water'
color = COLORS.get(id)
flowable = True
collision = False
def __init__(self, x: int, y: int):
super().__init__(x, y)

View File

@@ -1,4 +1,5 @@
from module import WIDTH, HEIGHT, JUMP_FORCE
from module.block import AirBlock
# 玩家类
@@ -8,7 +9,7 @@ class Player:
self.y = HEIGHT // 2
self.velocity = 0
self.on_ground = False
self.selected_block = "grass"
self.selected_block = AirBlock
def move(self, dx, dy):
new_x = self.x + dx