28 lines
669 B
Python
28 lines
669 B
Python
import os
|
|
|
|
from game.blocks.block import Block
|
|
from game.gameState import GameState
|
|
|
|
class CoinBlock(Block):
|
|
def __init__(self):
|
|
self.collected = False
|
|
|
|
@property
|
|
def character(self):
|
|
return '°'
|
|
|
|
@property
|
|
def type(self):
|
|
return 'coin'
|
|
|
|
@property
|
|
def solid(self):
|
|
return False
|
|
|
|
def on_collision(self, gameState: GameState):
|
|
if not self.collected:
|
|
gameState.add_coin()
|
|
self.collected = True
|
|
|
|
def to_string(self):
|
|
return " " if self.collected else "🪙" + (" " if os.getenv("SHOW_EXTRA_EMOJI_SPACES", "false").lower() == "true" else "") |