feat: add garbage
This commit is contained in:
parent
3d7553ad44
commit
0e86b5131b
|
@ -9,7 +9,7 @@
|
|||
"food_2": 1,
|
||||
"food_3": 1,
|
||||
"garbage_1": 3,
|
||||
"garbage_2": 0,
|
||||
"garbage_3": 0
|
||||
"garbage_2": 1,
|
||||
"garbage_3": 1
|
||||
|
||||
}
|
42
src/foods.py
42
src/foods.py
|
@ -101,34 +101,30 @@ class Food3(Food):
|
|||
self._vel = - FOOD3_VEL
|
||||
|
||||
|
||||
class BadFoodLv1(Food):
|
||||
class Garbage1(Food):
|
||||
def __init__(self, group):
|
||||
super().__init__(group)
|
||||
self.image = pygame.Surface([FOOD_LV1_SIZE, FOOD_LV1_SIZE])
|
||||
self.type = FoodTypeEnum.BAD_1
|
||||
self.color = FOOD_COLOR_MAP[self.type]
|
||||
self.score = -1
|
||||
self.rect = self.image.get_rect()
|
||||
self.angle = 0
|
||||
super().__init__(group, FoodTypeEnum.BAD_1, "garbage01",
|
||||
[FOOD_LV1_SIZE, FOOD_LV1_SIZE], -1)
|
||||
# self._vel = FOOD1_VEL
|
||||
|
||||
def update(self, playground: Rect, squid: pygame.sprite.Sprite):
|
||||
|
||||
class BadFoodLv2(Food):
|
||||
pass
|
||||
class Garbage2(Food):
|
||||
def __init__(self, group):
|
||||
super().__init__(group)
|
||||
super().__init__(group, FoodTypeEnum.BAD_2, "garbage02",
|
||||
[FOOD_LV2_SIZE, FOOD_LV2_SIZE], -1)
|
||||
# self._vel = FOOD1_VEL
|
||||
|
||||
self.image = pygame.Surface([FOOD_LV2_SIZE, FOOD_LV2_SIZE])
|
||||
self.type = FoodTypeEnum.BAD_2
|
||||
self.color = FOOD_COLOR_MAP[self.type]
|
||||
self.score = -2
|
||||
self.rect = self.image.get_rect()
|
||||
def update(self, playground: Rect, squid: pygame.sprite.Sprite):
|
||||
|
||||
|
||||
class BadFoodLv3(Food):
|
||||
pass
|
||||
class Garbage3(Food):
|
||||
def __init__(self, group):
|
||||
super().__init__(group)
|
||||
super().__init__(group, FoodTypeEnum.BAD_3, "garbage03",
|
||||
[FOOD_LV3_SIZE, FOOD_LV3_SIZE], -1)
|
||||
# self._vel = FOOD1_VEL
|
||||
|
||||
self.image = pygame.Surface([FOOD_LV3_SIZE, FOOD_LV3_SIZE])
|
||||
self.type = FoodTypeEnum.BAD_3
|
||||
self.color = FOOD_COLOR_MAP[self.type]
|
||||
self.score = -4
|
||||
self.rect = self.image.get_rect()
|
||||
def update(self, playground: Rect, squid: pygame.sprite.Sprite):
|
||||
|
||||
pass
|
||||
|
|
|
@ -83,6 +83,9 @@ class EasyGame(PaiaGame):
|
|||
self._create_foods(Food1, game_params.food_1)
|
||||
self._create_foods(Food2, game_params.food_2)
|
||||
self._create_foods(Food3, game_params.food_3)
|
||||
self._create_foods(Garbage1, game_params.garbage_1)
|
||||
self._create_foods(Garbage2, game_params.garbage_2)
|
||||
self._create_foods(Garbage3, game_params.garbage_3)
|
||||
|
||||
self.frame_count = 0
|
||||
self._frame_count_down = self._frame_limit
|
||||
|
@ -123,7 +126,7 @@ class EasyGame(PaiaGame):
|
|||
self._create_foods(food.__class__, 1)
|
||||
if isinstance(food, (Food1, Food2, Food3,)):
|
||||
self.sound_controller.play_eating_good()
|
||||
elif isinstance(food, (BadFoodLv1, BadFoodLv2, BadFoodLv3,)):
|
||||
elif isinstance(food, (Garbage1, Garbage2, Garbage3,)):
|
||||
self.sound_controller.play_eating_bad()
|
||||
|
||||
def get_data_from_game_to_player(self):
|
||||
|
@ -212,6 +215,9 @@ class EasyGame(PaiaGame):
|
|||
create_asset_init_data("food01", FOOD_LV1_SIZE, FOOD_LV1_SIZE, FOOD01_PATH, FOOD01_URL),
|
||||
create_asset_init_data("food02", FOOD_LV2_SIZE,FOOD_LV2_SIZE, FOOD02_PATH, FOOD02_URL),
|
||||
create_asset_init_data("food03", FOOD_LV3_SIZE,FOOD_LV3_SIZE, FOOD03_PATH, FOOD03_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(
|
||||
|
|
Loading…
Reference in New Issue