change get_collision_surface

This commit is contained in:
Jeffrey Hsu 2025-02-02 01:11:44 +08:00
parent 1a210382ae
commit 705b5c746a

View File

@ -46,13 +46,10 @@ class Block:
def get_collision_surface(self) -> tuple[int, int, int, int]: def get_collision_surface(self) -> tuple[int, int, int, int]:
# 获得方块表面界限(碰撞面) # 获得方块表面界限(碰撞面)
# 上、右、下、左 # 上、右、下、左
real_x = self.x * BLOCK_SIZE + BLOCK_SIZE / 2 top = self.y * BLOCK_SIZE
real_y = self.y * BLOCK_SIZE + BLOCK_SIZE / 2 bottom = top + BLOCK_SIZE
left = self.x * BLOCK_SIZE
top = real_y - BLOCK_SIZE / 2 right = left + BLOCK_SIZE
bottom = real_y + BLOCK_SIZE / 2
left = real_x - BLOCK_SIZE / 2
right = real_x + BLOCK_SIZE / 2
return top, right, bottom, left return top, right, bottom, left
def get_center_vector(self): def get_center_vector(self):