refac: update level file

This commit is contained in:
Kylin_on_Mac
2023-10-10 23:25:54 +08:00
parent a6fcbbe55f
commit 46e655930d
11 changed files with 70 additions and 28 deletions

View File

@ -1,6 +1,6 @@
import pygame.sprite
from games.easy_game.src.env import FoodTypeEnum, FOOD_COLOR_MAP
from games.easy_game.src.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
@ -33,20 +33,60 @@ class Food(pygame.sprite.Sprite):
class GoodFoodLv1(Food):
def __init__(self, group):
super().__init__(group)
self.image = pygame.Surface([8, 8])
self.image = pygame.Surface([FOOD_LV1_SIZE, FOOD_LV1_SIZE])
self.type = FoodTypeEnum.GOOD_1
self.color = FOOD_COLOR_MAP[self.type]
self.score = 1
self.rect = self.image.get_rect()
self.angle = 0
class GoodFoodLv2(Food):
def __init__(self, group):
super().__init__(group)
self.image = pygame.Surface([FOOD_LV2_SIZE, FOOD_LV2_SIZE])
self.type = FoodTypeEnum.GOOD_2
self.color = FOOD_COLOR_MAP[self.type]
self.score = 2
self.rect = self.image.get_rect()
class GoodFoodLv3(Food):
def __init__(self, group):
super().__init__(group)
self.image = pygame.Surface([FOOD_LV3_SIZE, FOOD_LV3_SIZE])
self.type = FoodTypeEnum.GOOD_3
self.color = FOOD_COLOR_MAP[self.type]
self.score = 4
self.rect = self.image.get_rect()
class BadFoodLv1(Food):
def __init__(self, group):
super().__init__(group)
self.image = pygame.Surface([8, 8])
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
class BadFoodLv2(Food):
def __init__(self, group):
super().__init__(group)
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()
class BadFoodLv3(Food):
def __init__(self, group):
super().__init__(group)
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()