modify world generation rule
This commit is contained in:
@@ -12,6 +12,7 @@ class Block:
|
||||
flowable = False # 可流动
|
||||
fallible = False # 可下坠
|
||||
collision = True # 可以碰撞
|
||||
destroyable = True # 可被破坏
|
||||
|
||||
def __init__(self, x: int, y: int):
|
||||
self.x = x
|
||||
@@ -42,7 +43,7 @@ class Block:
|
||||
# 判碰撞:
|
||||
return left < player.x < right and top < player.y < bottom
|
||||
|
||||
def get_collision_surface(self) -> tuple[int]:
|
||||
def get_collision_surface(self) -> tuple[int, int, int, int]:
|
||||
# 获得方块表面界限(碰撞面)
|
||||
# 上、右、下、左
|
||||
real_x = self.x * BLOCK_SIZE + BLOCK_SIZE / 2
|
||||
@@ -107,4 +108,9 @@ class WaterBlock(Block):
|
||||
collision = False
|
||||
|
||||
def __init__(self, x: int, y: int):
|
||||
super().__init__(x, y)
|
||||
super().__init__(x, y)
|
||||
|
||||
class BedrockBlock(Block):
|
||||
id = 'bedrock'
|
||||
color = COLORS.get(id)
|
||||
destroyable = False
|
||||
Reference in New Issue
Block a user