revise info board
This commit is contained in:
parent
e6b017985e
commit
f20132efe3
|
@ -237,13 +237,13 @@ class MLPlay:
|
|||
"squid": "1P",
|
||||
"score": 0,
|
||||
"rank": 2,
|
||||
"wins": 1 / 3
|
||||
"wins": "1 / 3"
|
||||
},
|
||||
{
|
||||
"squid": "2P",
|
||||
"score": 10,
|
||||
"rank": 1,
|
||||
"wins": 2 / 3
|
||||
"wins": "2 / 3"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"game_name": "swimming-squid",
|
||||
"version": " 1.0.2",
|
||||
"version": " 1.0.4",
|
||||
"url": "https://github.com/PAIA-Playful-AI-Arena/swimming-squid",
|
||||
"description": "這是一個魷魚吃東西小遊戲,你需要找到正確的食物、避開海中的垃圾,還要提防敵人的攻擊!(當然你也可以主動攻擊他人)",
|
||||
"logo": [
|
||||
|
@ -29,7 +29,7 @@
|
|||
},
|
||||
{
|
||||
"name": "game_times",
|
||||
"verbose": "對站次數",
|
||||
"verbose": "對戰次數",
|
||||
"type": "int",
|
||||
"choices": [
|
||||
1, 3, 5
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"time_to_play": 1400,
|
||||
"playground_size_w":500,
|
||||
"playground_size_h":500,
|
||||
"playground_size_w":700,
|
||||
"playground_size_h":600,
|
||||
"score_to_pass": 80,
|
||||
"food_1": 6,
|
||||
"food_2": 4,
|
||||
|
|
47
src/game.py
47
src/game.py
|
@ -71,6 +71,8 @@ class SwimmingSquid(PaiaGame):
|
|||
self._used_file = "001.json"
|
||||
finally:
|
||||
# set game params
|
||||
if game_params.playground_size_w > 700:
|
||||
game_params.playground_size_w = 700
|
||||
self.playground = pygame.Rect(
|
||||
0, 0,
|
||||
game_params.playground_size_w,
|
||||
|
@ -79,6 +81,7 @@ class SwimmingSquid(PaiaGame):
|
|||
|
||||
self._score_to_pass = game_params.score_to_pass
|
||||
self._frame_limit = game_params.time_to_play
|
||||
|
||||
self.playground.center = ((WIDTH - WIDTH_OF_INFO) / 2, HEIGHT / 2)
|
||||
|
||||
# init game
|
||||
|
@ -338,6 +341,29 @@ class SwimmingSquid(PaiaGame):
|
|||
for food in self.foods:
|
||||
foods_data.append(food.game_object_data)
|
||||
game_obj_list = [self.squid1.game_object_data, self.squid2.game_object_data]
|
||||
toggle_objs = [
|
||||
create_text_view_data(f"{self._winner.count('1P')}:{self._winner.count('2P')}", 795, 20, "#EEEEEE",
|
||||
"36px Consolas BOLD"),
|
||||
create_text_view_data(f"Timer:{self._frame_count_down:04d}", 745, 80, "#EEEEEE", "20px Consolas BOLD"),
|
||||
# create_text_view_data(f"", 785, 80, "#EEEEEE", "18px Consolas BOLD"),
|
||||
create_text_view_data(f"File :{os.path.basename(self._used_file)}", 745, 120, "#EEEEEE", "20px Consolas BOLD"),
|
||||
# create_text_view_data(f"File :{self._level_file}", 605, 80, "#EEEEEE", "10px Consolas BOLD"),
|
||||
create_text_view_data(f"Goal :{self._score_to_pass:04d} pt", 745, 160, "#EEEEEE", "20px Consolas BOLD"),
|
||||
# create_text_view_data(f"", 785, 140, "#EEEEEE", "18px Consolas BOLD"),
|
||||
create_image_view_data("squid1", 705, 220, 76, 114),
|
||||
# create_text_view_data("1P", 705, 130, "#EEEEEE", "22px Consolas BOLD"),
|
||||
create_text_view_data(f"Lv : {self.squid1.lv}", 785, 220, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Next Lv: {LEVEL_THRESHOLDS[self.squid1.lv - 1]-self.squid1.score :04d} pt", 785, 250, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Vel : {self.squid1.vel:2d}", 785, 280, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Score : {self.squid1.score:04d} pt", 785, 310, "#EEEEEE", "16px Consolas BOLD"),
|
||||
# create_text_view_data("2P", 705, 310, "#EEEEEE", "22px Consolas BOLD"),
|
||||
create_image_view_data("squid2", 705, 410, 76, 114),
|
||||
create_text_view_data(f"Lv : {self.squid2.lv}", 785, 410, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Next Lv: {LEVEL_THRESHOLDS[self.squid2.lv - 1] - self.squid2.score :04d} pt", 785,
|
||||
440, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Vel : {self.squid2.vel:2d}", 785, 470, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Score : {self.squid2.score:04d} pt", 785, 500, "#EEEEEE", "16px Consolas BOLD"),
|
||||
]
|
||||
game_obj_list.extend(foods_data)
|
||||
backgrounds = [
|
||||
# create_image_view_data("background", 0, 0, WIDTH, HEIGHT),
|
||||
|
@ -351,27 +377,6 @@ class SwimmingSquid(PaiaGame):
|
|||
foregrounds = [
|
||||
|
||||
]
|
||||
toggle_objs = [
|
||||
create_text_view_data(f"Timer:{self._frame_count_down:04d}", 745, 40, "#EEEEEE", "20px Consolas BOLD"),
|
||||
# create_text_view_data(f"", 785, 80, "#EEEEEE", "18px Consolas BOLD"),
|
||||
create_text_view_data(f"File :{os.path.basename(self._used_file)}", 745, 80, "#EEEEEE", "20px Consolas BOLD"),
|
||||
# create_text_view_data(f"File :{self._level_file}", 605, 80, "#EEEEEE", "10px Consolas BOLD"),
|
||||
create_text_view_data(f"Goal :{self._score_to_pass:04d} pt", 745, 120, "#EEEEEE", "20px Consolas BOLD"),
|
||||
# create_text_view_data(f"", 785, 140, "#EEEEEE", "18px Consolas BOLD"),
|
||||
create_image_view_data("squid1", 705, 180, 76, 114),
|
||||
# create_text_view_data("1P", 705, 130, "#EEEEEE", "22px Consolas BOLD"),
|
||||
create_text_view_data(f"Lv : {self.squid1.lv}", 785, 180, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Next Lv: {LEVEL_THRESHOLDS[self.squid1.lv - 1]-self.squid1.score :04d} pt", 785, 210, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Vel : {self.squid1.vel:2d}", 785, 240, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Score : {self.squid1.score:04d} pt", 785, 270, "#EEEEEE", "16px Consolas BOLD"),
|
||||
# create_text_view_data("2P", 705, 310, "#EEEEEE", "22px Consolas BOLD"),
|
||||
create_image_view_data("squid2", 705, 390, 76, 114),
|
||||
create_text_view_data(f"Lv : {self.squid2.lv}", 785, 390, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Next Lv: {LEVEL_THRESHOLDS[self.squid2.lv - 1] - self.squid2.score :04d} pt", 785,
|
||||
420, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Vel : {self.squid2.vel:2d}", 785, 450, "#EEEEEE", "16px Consolas BOLD"),
|
||||
create_text_view_data(f"Score : {self.squid2.score:04d} pt", 785, 480, "#EEEEEE", "16px Consolas BOLD"),
|
||||
]
|
||||
|
||||
scene_progress = create_scene_progress_data(
|
||||
frame=self.frame_count, background=backgrounds,
|
||||
|
|
Loading…
Reference in New Issue