Added coins
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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 "")
|
||||
Reference in New Issue
Block a user