feat: update text position
This commit is contained in:
parent
fd3b9936c9
commit
ad3953c0b5
15
src/env.py
15
src/env.py
|
@ -27,18 +27,11 @@ class FoodTypeEnum(StringEnum):
|
||||||
FOOD_1 = auto()
|
FOOD_1 = auto()
|
||||||
FOOD_2 = auto()
|
FOOD_2 = auto()
|
||||||
FOOD_3 = auto()
|
FOOD_3 = auto()
|
||||||
BAD_1 = auto()
|
GARBAGE_1 = auto()
|
||||||
BAD_2 = auto()
|
GARBAGE_2 = auto()
|
||||||
BAD_3 = auto()
|
GARBAGE_3 = auto()
|
||||||
|
|
||||||
|
|
||||||
FOOD_COLOR_MAP = {
|
|
||||||
FoodTypeEnum.FOOD_1: "#009688",
|
|
||||||
FoodTypeEnum.FOOD_2: "#009688",
|
|
||||||
FoodTypeEnum.FOOD_3: "#009688",
|
|
||||||
FoodTypeEnum.BAD_1: "#FF1744",
|
|
||||||
FoodTypeEnum.BAD_2: "#FF1744",
|
|
||||||
FoodTypeEnum.BAD_3: "#FF1744"
|
|
||||||
}
|
|
||||||
FOOD_LV1_SIZE = 30
|
FOOD_LV1_SIZE = 30
|
||||||
FOOD_LV2_SIZE = 40
|
FOOD_LV2_SIZE = 40
|
||||||
FOOD_LV3_SIZE = 50
|
FOOD_LV3_SIZE = 50
|
||||||
|
|
|
@ -102,7 +102,7 @@ class Food3(Food):
|
||||||
|
|
||||||
class Garbage1(Food):
|
class Garbage1(Food):
|
||||||
def __init__(self, group):
|
def __init__(self, group):
|
||||||
super().__init__(group, FoodTypeEnum.BAD_1, "garbage01",
|
super().__init__(group, FoodTypeEnum.GARBAGE_1, "garbage01",
|
||||||
[FOOD_LV1_SIZE, FOOD_LV1_SIZE], -1)
|
[FOOD_LV1_SIZE, FOOD_LV1_SIZE], -1)
|
||||||
self._vel = FOOD1_VEL
|
self._vel = FOOD1_VEL
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class Garbage1(Food):
|
||||||
|
|
||||||
class Garbage2(Food):
|
class Garbage2(Food):
|
||||||
def __init__(self, group):
|
def __init__(self, group):
|
||||||
super().__init__(group, FoodTypeEnum.BAD_2, "garbage02",
|
super().__init__(group, FoodTypeEnum.GARBAGE_2, "garbage02",
|
||||||
[FOOD_LV2_SIZE, FOOD_LV2_SIZE], -1)
|
[FOOD_LV2_SIZE, FOOD_LV2_SIZE], -1)
|
||||||
self._vel = FOOD2_VEL
|
self._vel = FOOD2_VEL
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class Garbage2(Food):
|
||||||
|
|
||||||
class Garbage3(Food):
|
class Garbage3(Food):
|
||||||
def __init__(self, group):
|
def __init__(self, group):
|
||||||
super().__init__(group, FoodTypeEnum.BAD_3, "garbage03",
|
super().__init__(group, FoodTypeEnum.GARBAGE_3, "garbage03",
|
||||||
[FOOD_LV3_SIZE, FOOD_LV3_SIZE], -1)
|
[FOOD_LV3_SIZE, FOOD_LV3_SIZE], -1)
|
||||||
self._vel = FOOD1_VEL
|
self._vel = FOOD1_VEL
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ class EasyGame(PaiaGame):
|
||||||
foods_data = []
|
foods_data = []
|
||||||
for food in self.foods:
|
for food in self.foods:
|
||||||
# TODO 確認要提供中心點座標還是左上角座標。
|
# TODO 確認要提供中心點座標還是左上角座標。
|
||||||
foods_data.append({"x": food.rect.x, "y": food.rect.y, "type": food.type, "score": food.score})
|
foods_data.append({"x": food.rect.centerx, "y": food.rect.centery, "type": food.type, "score": food.score})
|
||||||
|
|
||||||
data_to_1p = {
|
data_to_1p = {
|
||||||
"frame": self.frame_count,
|
"frame": self.frame_count,
|
||||||
|
@ -248,9 +248,9 @@ class EasyGame(PaiaGame):
|
||||||
|
|
||||||
]
|
]
|
||||||
toggle_objs = [
|
toggle_objs = [
|
||||||
create_text_view_data(f"Score:{self.ball.score:04d}", 600, 50, "#A5D6A7", "24px Arial BOLD"),
|
create_text_view_data(f"Score: {self.ball.score:04d}", 750, 50, "#EEEEEE", "24px Arial BOLD"),
|
||||||
create_text_view_data(f" Next:{self._score_to_pass:04d}", 600, 100, "#FF4081", "24px Arial BOLD"),
|
create_text_view_data(f"Next : {self._score_to_pass:04d}", 750, 100, "#EEEEEE", "24px Arial BOLD"),
|
||||||
create_text_view_data(f" Time:{self._frame_count_down:04d}", 600, 150, "#FF5722", "24px Arial BOLD"),
|
create_text_view_data(f"Time : {self._frame_count_down:04d}", 750, 150, "#EEEEEE", "24px Arial BOLD"),
|
||||||
|
|
||||||
]
|
]
|
||||||
scene_progress = create_scene_progress_data(frame=self.frame_count, background=backgrounds,
|
scene_progress = create_scene_progress_data(frame=self.frame_count, background=backgrounds,
|
||||||
|
|
|
@ -14,7 +14,8 @@ from mlgame.view.view_model import create_rect_view_data, create_image_view_data
|
||||||
|
|
||||||
|
|
||||||
class LevelParams(pydantic.BaseModel):
|
class LevelParams(pydantic.BaseModel):
|
||||||
# TODO max and min
|
# TODO max w 700 and min 100
|
||||||
|
# TODO max h 600 and min 100
|
||||||
playground_size_w: int = 300
|
playground_size_w: int = 300
|
||||||
playground_size_h: int = 300
|
playground_size_h: int = 300
|
||||||
score_to_pass: int = 10
|
score_to_pass: int = 10
|
||||||
|
|
Loading…
Reference in New Issue