feat: add food1 img
BIN
asset/img/background.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
asset/img/food_01.png
Normal file
After Width: | Height: | Size: 191 KiB |
BIN
asset/img/food_02.png
Normal file
After Width: | Height: | Size: 223 KiB |
BIN
asset/img/food_03.png
Normal file
After Width: | Height: | Size: 225 KiB |
BIN
asset/img/garbage_01.png
Normal file
After Width: | Height: | Size: 169 KiB |
BIN
asset/img/garbage_02.png
Normal file
After Width: | Height: | Size: 298 KiB |
BIN
asset/img/garbage_03.png
Normal file
After Width: | Height: | Size: 299 KiB |
BIN
asset/img/squid.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
asset/logo.png
Normal file
After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 82 KiB |
@ -21,6 +21,7 @@ BALL_SIZE_MIN = 10
|
||||
BALL_VEL_MAX = 25
|
||||
BALL_VEL_MIN = 10
|
||||
|
||||
ASSET_IMAGE_DIR = path.join(path.dirname(__file__), "../asset/img")
|
||||
# food
|
||||
class FoodTypeEnum(StringEnum):
|
||||
GOOD_1 = auto()
|
||||
@ -38,7 +39,7 @@ FOOD_COLOR_MAP = {
|
||||
FoodTypeEnum.BAD_2: "#FF1744",
|
||||
FoodTypeEnum.BAD_3: "#FF1744"
|
||||
}
|
||||
FOOD_LV1_SIZE = 8
|
||||
FOOD_LV1_SIZE = 20
|
||||
FOOD_LV2_SIZE = 12
|
||||
FOOD_LV3_SIZE = 16
|
||||
|
||||
|
11
src/foods.py
@ -4,7 +4,7 @@ import pygame.sprite
|
||||
from pygame import Rect
|
||||
|
||||
from .env import FoodTypeEnum, FOOD_COLOR_MAP, FOOD_LV1_SIZE, FOOD_LV2_SIZE, FOOD_LV3_SIZE
|
||||
from mlgame.view.view_model import create_rect_view_data
|
||||
from mlgame.view.view_model import create_rect_view_data, create_image_view_data
|
||||
|
||||
FOOD1_VEL = 1
|
||||
|
||||
@ -100,6 +100,15 @@ class Food1(Food):
|
||||
self._vel = FOOD1_VEL
|
||||
elif self.rect.right > playground.right and self._vel>0.0:
|
||||
self._vel = - FOOD1_VEL
|
||||
@property
|
||||
def game_object_data(self):
|
||||
return create_image_view_data(
|
||||
"food01",
|
||||
self.rect.x,
|
||||
self.rect.y,
|
||||
self.rect.width,
|
||||
self.rect.height
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -221,9 +221,11 @@ class EasyGame(PaiaGame):
|
||||
# background = create_asset_init_data(
|
||||
# "background", WIDTH, HEIGHT, bg_path,
|
||||
# github_raw_url="https://raw.githubusercontent.com/PAIA-Playful-AI-Arena/easy_game/main/asset/img/background.jpg")
|
||||
food01_path = path.join(ASSET_IMAGE_DIR, "food_01.png")
|
||||
food01_url = food01_path
|
||||
scene_init_data = {"scene": self.scene.__dict__,
|
||||
"assets": [
|
||||
# background
|
||||
create_asset_init_data("food01", 20, 20, food01_path,food01_url)
|
||||
],
|
||||
# "audios": {}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ from .foods import Food
|
||||
from .sound_controller import SoundController
|
||||
from mlgame.view.view_model import create_rect_view_data
|
||||
|
||||
|
||||
class LevelParams(pydantic.BaseModel):
|
||||
playground_w: int = 100
|
||||
playground_h: int = 200
|
||||
@ -26,6 +27,7 @@ class LevelParams(pydantic.BaseModel):
|
||||
garbage_2: int = 0
|
||||
garbage_3: int = 0
|
||||
|
||||
|
||||
class Ball(pygame.sprite.Sprite):
|
||||
def __init__(self):
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
@ -84,6 +86,7 @@ class Ball(pygame.sprite.Sprite):
|
||||
@property
|
||||
def score(self):
|
||||
return self._score
|
||||
|
||||
@property
|
||||
def vel(self):
|
||||
return self._vel
|