Merge branch 'release/2.4a3'
This commit is contained in:
commit
cb5cc934e1
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"game_name": "swimming-squid",
|
||||
"version": "2.4a2",
|
||||
"version": "2.4a3",
|
||||
"url": "https://github.com/PAIA-Playful-AI-Arena/swimming-squid",
|
||||
"description": "這是一個魷魚吃東西小遊戲,除了讓你熟習所有基本操作,也是 PAIA 的遊戲教學範例",
|
||||
"logo": [
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"time_to_play": 300,
|
||||
"time_to_play": 350,
|
||||
"playground_size_w":350,
|
||||
"playground_size_h":350,
|
||||
"score_to_pass": 10,
|
||||
"score_to_pass": 20,
|
||||
"food_1": 5,
|
||||
"food_2": 0,
|
||||
"food_3": 0,
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"time_to_play": 500,
|
||||
"playground_size_w":350,
|
||||
"playground_size_h":350,
|
||||
"score_to_pass": 15,
|
||||
"food_1": 3,
|
||||
"food_2": 0,
|
||||
"score_to_pass": 30,
|
||||
"food_1": 5,
|
||||
"food_2": 1,
|
||||
"food_3": 0,
|
||||
"garbage_1": 3,
|
||||
"garbage_2": 0,
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"time_to_play": 600,
|
||||
"playground_size_w":400,
|
||||
"playground_size_h":400,
|
||||
"score_to_pass": 20,
|
||||
"score_to_pass": 40,
|
||||
"food_1": 8,
|
||||
"food_2": 0,
|
||||
"food_2": 2,
|
||||
"food_3": 0,
|
||||
"garbage_1": 4,
|
||||
"garbage_2": 0,
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
"time_to_play": 800,
|
||||
"playground_size_w":400,
|
||||
"playground_size_h":400,
|
||||
"score_to_pass": 30,
|
||||
"score_to_pass": 50,
|
||||
"food_1": 8,
|
||||
"food_2": 3,
|
||||
"food_2": 4,
|
||||
"food_3": 0,
|
||||
"garbage_1": 3,
|
||||
"garbage_2": 0,
|
||||
"garbage_2": 1,
|
||||
"garbage_3": 0
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"time_to_play": 1000,
|
||||
"playground_size_w":400,
|
||||
"playground_size_h":400,
|
||||
"score_to_pass": 30,
|
||||
"score_to_pass": 60,
|
||||
"food_1": 8,
|
||||
"food_2": 4,
|
||||
"food_3": 0,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"time_to_play": 800,
|
||||
"time_to_play": 1200,
|
||||
"playground_size_w":500,
|
||||
"playground_size_h":500,
|
||||
"score_to_pass": 30,
|
||||
"score_to_pass": 70,
|
||||
"food_1": 8,
|
||||
"food_2": 4,
|
||||
"food_3": 2,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"time_to_play": 1200,
|
||||
"time_to_play": 1400,
|
||||
"playground_size_w":500,
|
||||
"playground_size_h":500,
|
||||
"score_to_pass": 50,
|
||||
"score_to_pass": 80,
|
||||
"food_1": 6,
|
||||
"food_2": 4,
|
||||
"food_3": 2,
|
||||
"garbage_1": 6,
|
||||
"garbage_2": 4,
|
||||
"garbage_1": 3,
|
||||
"garbage_2": 2,
|
||||
"garbage_3": 2
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"time_to_play": 1200,
|
||||
"time_to_play": 1600,
|
||||
"playground_size_w":600,
|
||||
"playground_size_h":600,
|
||||
"score_to_pass": 50,
|
||||
"score_to_pass": 90,
|
||||
"food_1": 6,
|
||||
"food_2": 5,
|
||||
"food_3": 3,
|
||||
"garbage_1": 8,
|
||||
"garbage_2": 8,
|
||||
"garbage_3": 5
|
||||
"garbage_1": 4,
|
||||
"garbage_2": 4,
|
||||
"garbage_3": 2
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"time_to_play": 1200,
|
||||
"time_to_play": 1800,
|
||||
"playground_size_w":700,
|
||||
"playground_size_h":600,
|
||||
"score_to_pass": 50,
|
||||
"food_1": 12,
|
||||
"score_to_pass": 100,
|
||||
"food_1": 10,
|
||||
"food_2": 8,
|
||||
"food_3": 4,
|
||||
"garbage_1": 25,
|
||||
"garbage_2": 10,
|
||||
"garbage_3": 8
|
||||
"garbage_1": 10,
|
||||
"garbage_2": 8,
|
||||
"garbage_3": 4
|
||||
}
|
|
@ -3,7 +3,9 @@ from os import path
|
|||
|
||||
from mlgame.utils.enum import StringEnum
|
||||
# game
|
||||
WIDTH = 900
|
||||
WIDTH = 950
|
||||
WIDTH_OF_INFO = 250
|
||||
|
||||
HEIGHT = 600
|
||||
BG_COLOR = "#2B2B49"
|
||||
PG_COLOR = "#B3E5FC"
|
||||
|
|
33
src/game.py
33
src/game.py
|
@ -8,7 +8,6 @@ from mlgame.game.paia_game import PaiaGame, GameResultState, GameStatus
|
|||
from mlgame.utils.enum import get_ai_name
|
||||
from mlgame.view.decorator import check_game_progress, check_game_result
|
||||
from mlgame.view.view_model import *
|
||||
from .env import *
|
||||
from .foods import *
|
||||
from .game_object import Squid, LevelParams
|
||||
from .sound_controller import SoundController
|
||||
|
@ -73,7 +72,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-200) / 2, HEIGHT / 2)
|
||||
self.playground.center = ((WIDTH - WIDTH_OF_INFO) / 2, HEIGHT / 2)
|
||||
|
||||
# init game
|
||||
self.squid = Squid()
|
||||
|
@ -137,7 +136,7 @@ class SwimmingSquid(PaiaGame):
|
|||
for food in self.foods:
|
||||
foods_data.append(
|
||||
{"x": food.rect.centerx, "y": food.rect.centery,
|
||||
"w":food.rect.width,"h":food.rect.height,
|
||||
"w": food.rect.width, "h": food.rect.height,
|
||||
"type": str(food.type), "score": food.score}
|
||||
)
|
||||
|
||||
|
@ -193,11 +192,12 @@ class SwimmingSquid(PaiaGame):
|
|||
|
||||
@property
|
||||
def is_passed(self):
|
||||
return self.squid.score > self._score_to_pass
|
||||
return self.squid.score >= self._score_to_pass
|
||||
|
||||
@property
|
||||
def is_running(self):
|
||||
return self.frame_count < self._frame_limit
|
||||
# return self.frame_count < self._frame_limit
|
||||
return (self.frame_count < self._frame_limit) and (not self.is_passed)
|
||||
|
||||
def get_scene_init_data(self):
|
||||
"""
|
||||
|
@ -219,9 +219,9 @@ class SwimmingSquid(PaiaGame):
|
|||
create_asset_init_data(IMG_ID_FOOD01_R, FOOD_LV1_SIZE, FOOD_LV1_SIZE, FOOD01_R_PATH, FOOD01_R_URL),
|
||||
create_asset_init_data(IMG_ID_FOOD02_R, FOOD_LV2_SIZE, FOOD_LV2_SIZE, FOOD02_R_PATH, FOOD02_R_URL),
|
||||
create_asset_init_data(IMG_ID_FOOD03_R, FOOD_LV3_SIZE, FOOD_LV3_SIZE, FOOD03_R_PATH, FOOD03_R_URL),
|
||||
create_asset_init_data("garbage01", FOOD_LV1_SIZE,FOOD_LV1_SIZE, GARBAGE01_PATH, GARBAGE01_URL),
|
||||
create_asset_init_data("garbage02", FOOD_LV2_SIZE,FOOD_LV2_SIZE, GARBAGE02_PATH, GARBAGE02_URL),
|
||||
create_asset_init_data("garbage03", FOOD_LV3_SIZE,FOOD_LV3_SIZE, GARBAGE03_PATH, GARBAGE03_URL),
|
||||
create_asset_init_data("garbage01", FOOD_LV1_SIZE, FOOD_LV1_SIZE, GARBAGE01_PATH, GARBAGE01_URL),
|
||||
create_asset_init_data("garbage02", FOOD_LV2_SIZE, FOOD_LV2_SIZE, GARBAGE02_PATH, GARBAGE02_URL),
|
||||
create_asset_init_data("garbage03", FOOD_LV3_SIZE, FOOD_LV3_SIZE, GARBAGE03_PATH, GARBAGE03_URL),
|
||||
],
|
||||
"background": [
|
||||
# create_image_view_data(
|
||||
|
@ -254,16 +254,17 @@ class SwimmingSquid(PaiaGame):
|
|||
foregrounds = [
|
||||
|
||||
]
|
||||
star_string = '+' * self.squid.lv
|
||||
toggle_objs = [
|
||||
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"),
|
||||
|
||||
create_text_view_data(f"Squid Lv: {star_string}", 705, 50, "#EEEEEE", "20px Consolas BOLD"),
|
||||
create_text_view_data(f"To Lv up: {LEVEL_THRESHOLDS[self.squid.lv - 1]-self.squid.score :04d} pt", 705, 80, "#EEEEEE", "20px Consolas BOLD"),
|
||||
create_text_view_data(f"Vel : {self.squid.vel:4d}", 705, 110, "#EEEEEE", "20px Consolas BOLD"),
|
||||
create_text_view_data(f"Timer : {self._frame_count_down:04d}", 705, 150, "#EEEEEE", "20px Consolas BOLD"),
|
||||
create_text_view_data(f"My Score: {self.squid.score:04d} pt", 705, 180, "#EEEEEE", "20px Consolas BOLD"),
|
||||
create_text_view_data(f"Goal : {self._score_to_pass:04d} pt", 705, 210, "#EEEEEE", "20px Consolas 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,
|
||||
object_list=game_obj_list,
|
||||
foreground=foregrounds, toggle=toggle_objs)
|
||||
return scene_progress
|
||||
|
|
Loading…
Reference in New Issue