fix:update size and vel formula

This commit is contained in:
Kylin_on_Mac 2023-10-12 17:16:11 +08:00
parent 90d55cef6b
commit 88eec69799
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ class Ball(pygame.sprite.Sprite):
def eat_food_and_change_level_and_play_sound(self, food: Food,sound_controller:SoundController): def eat_food_and_change_level_and_play_sound(self, food: Food,sound_controller:SoundController):
self._score += food.score self._score += food.score
new_lv = math.ceil((self._score + 1) / BALL_GROWTH_SCORE_STEP) new_lv = math.ceil((self._score-BALL_GROWTH_SCORE_STEP + 1) / BALL_GROWTH_SCORE_STEP)
self.rect.width = max(BALL_SIZE_MIN,min(BALL_W + new_lv * BALL_GROWTH_SIZE_STEP, BALL_SIZE_MAX)) self.rect.width = max(BALL_SIZE_MIN,min(BALL_W + new_lv * BALL_GROWTH_SIZE_STEP, BALL_SIZE_MAX))
self.rect.height = max(BALL_SIZE_MIN,min(BALL_H + new_lv * BALL_GROWTH_SIZE_STEP, BALL_SIZE_MAX)) self.rect.height = max(BALL_SIZE_MIN,min(BALL_H + new_lv * BALL_GROWTH_SIZE_STEP, BALL_SIZE_MAX))
self._vel = max(BALL_VEL_MIN,min(BALL_VEL + new_lv * BALL_GROWTH_VEL_STEP, BALL_VEL_MAX)) self._vel = max(BALL_VEL_MIN,min(BALL_VEL + new_lv * BALL_GROWTH_VEL_STEP, BALL_VEL_MAX))