-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBaseBlock.py
More file actions
59 lines (45 loc) · 1.46 KB
/
Copy pathBaseBlock.py
File metadata and controls
59 lines (45 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import pygame
from Settings import *
from pygame.math import Vector2
from pygame.rect import Rect
from typing import Union
class BaseBlock():
def __init__(self, id: str, location: Vector2, text=False, moveable=False, controllable=False,passable=True):
"""
:param id: 每个关卡方块的唯一编号
:param text: 方块是否是语法方块
:param passable: 方块是否能被穿过
:param moveable: 方块是否可以移动
:param controllable: 方块是否可以被控制
:param location: 方块的初始位置
:param texture: 方块的贴图
"""
self.id = id
self._text = text
self._passable = passable
self._moveable = moveable
self._controllable = controllable
self.location = location
self.rect = Rect(self.location.x, self.location.y, CELL_SIZE_X, CELL_SIZE_Y)
def cartoon(self):
pass
def is_text(self) -> bool:
"""
:return: 返回方块是否是语法方块
"""
return self._text
def is_pass(self) -> bool:
"""
:return: 返回方块是否可以被穿过
"""
return self._passable
def is_move(self) -> bool:
"""
:return: 返回方块是否可以移动
"""
return self._moveable
def is_control(self) -> bool:
"""
:return: 返回方块是否可以被控制
"""
return self._controllable