feat:update data to player
This commit is contained in:
@ -127,7 +127,7 @@ class Garbage1(Food):
|
||||
class Garbage2(Food):
|
||||
def __init__(self, group):
|
||||
super().__init__(group, FoodTypeEnum.GARBAGE_2, "garbage02",
|
||||
[FOOD_LV2_SIZE, FOOD_LV2_SIZE], -1)
|
||||
[FOOD_LV2_SIZE, FOOD_LV2_SIZE], -4)
|
||||
self._vel = FOOD2_VEL
|
||||
|
||||
def update(self, playground: Rect, squid: pygame.sprite.Sprite):
|
||||
@ -146,7 +146,7 @@ class Garbage2(Food):
|
||||
class Garbage3(Food):
|
||||
def __init__(self, group):
|
||||
super().__init__(group, FoodTypeEnum.GARBAGE_3, "garbage03",
|
||||
[FOOD_LV3_SIZE, FOOD_LV3_SIZE], -1)
|
||||
[FOOD_LV3_SIZE, FOOD_LV3_SIZE], -10)
|
||||
self._vel = FOOD1_VEL
|
||||
|
||||
def update(self, playground: Rect, squid: pygame.sprite.Sprite):
|
||||
|
25
src/game.py
25
src/game.py
@ -136,18 +136,17 @@ class EasyGame(PaiaGame):
|
||||
to_players_data = {}
|
||||
foods_data = []
|
||||
for food in self.foods:
|
||||
# TODO 確認要提供中心點座標還是左上角座標。
|
||||
foods_data.append({"x": food.rect.centerx, "y": food.rect.centery, "type": food.type, "score": food.score})
|
||||
|
||||
data_to_1p = {
|
||||
"frame": self.frame_count,
|
||||
# TODO 確認要提供中心點座標還是左上角座標。
|
||||
"player_x": self.squid.rect.centerx,
|
||||
"player_y": self.squid.rect.centery,
|
||||
"player_size": self.squid.rect.width,
|
||||
"player_vel": self.squid.vel,
|
||||
"squid_x": self.squid.rect.centerx,
|
||||
"squid_y": self.squid.rect.centery,
|
||||
"squid_w": self.squid.rect.width,
|
||||
"squid_h": self.squid.rect.height,
|
||||
"squid_vel": self.squid.vel,
|
||||
"squid_lv": self.squid.lv,
|
||||
"foods": foods_data,
|
||||
|
||||
"score": self.squid.score,
|
||||
"score_to_pass": self._score_to_pass,
|
||||
"status": self.get_game_status()
|
||||
@ -253,12 +252,12 @@ class EasyGame(PaiaGame):
|
||||
|
||||
]
|
||||
toggle_objs = [
|
||||
create_text_view_data(f"Lv : {self.squid.lv:4d}", 750, 50, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Vel : {self.squid.vel:4d}", 750, 80, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Score: {self.squid.score:04d}", 750, 110, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Lv_up: {LEVEL_THRESHOLDS[self.squid.lv-1]:4d}", 750, 140, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Time : {self._frame_count_down:04d}", 750, 200, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"ToPass: {self._score_to_pass:04d}", 750, 230, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Lv : {self.squid.lv:4d}", 720, 50, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Vel : {self.squid.vel:4d}", 720, 80, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Score: {self.squid.score:04d}", 720, 110, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Lv_up: {LEVEL_THRESHOLDS[self.squid.lv-1]:4d}", 720, 140, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"Time : {self._frame_count_down:04d}", 720, 200, "#EEEEEE", "24px Arial BOLD"),
|
||||
create_text_view_data(f"ToPass: {self._score_to_pass:04d}", 720, 230, "#EEEEEE", "24px Arial BOLD"),
|
||||
|
||||
]
|
||||
scene_progress = create_scene_progress_data(frame=self.frame_count, background=backgrounds,
|
||||
|
@ -12,8 +12,7 @@ from mlgame.view.view_model import create_rect_view_data, create_image_view_data
|
||||
|
||||
|
||||
class LevelParams(pydantic.BaseModel):
|
||||
# TODO max w 700 and min 100
|
||||
# TODO max h 600 and min 100
|
||||
|
||||
playground_size_w: int = 300
|
||||
playground_size_h: int = 300
|
||||
score_to_pass: int = 10
|
||||
|
Reference in New Issue
Block a user