refac: update level file
This commit is contained in:
48
src/foods.py
48
src/foods.py
@ -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()
|
||||
|
Reference in New Issue
Block a user