Random block variants

main
Yan Wittmann 2023-03-26 17:14:02 +02:00
parent 29950fb0f8
commit 7d5f37367f
1 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,5 @@
import random
from level.Level import Level from level.Level import Level
from level.LevelElementSymbols import LevelElementSymbols from level.LevelElementSymbols import LevelElementSymbols
from level.elements.BlockElement import BlockElement from level.elements.BlockElement import BlockElement
@ -25,7 +27,7 @@ class LoadedLevel:
if tile_element in LevelElementSymbols.BLOCKS_LIST: if tile_element in LevelElementSymbols.BLOCKS_LIST:
spritesheet = self.spritesheet_manager.get_sheet(level.theme + tile_element['sprite_id']) spritesheet = self.spritesheet_manager.get_sheet(level.theme + tile_element['sprite_id'])
sprite = BlockElement(spritesheet) sprite = BlockElement(spritesheet)
sprite.set_animation_state('1') sprite.set_animation_state(str(random.randint(0, 3)))
sprite.position_scale.position = position sprite.position_scale.position = position
# tile['id'], tile['requirements'] # tile['id'], tile['requirements']