From 12343ead8865e648b1e7341cbcc2318af7d54455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filips=20Kalni=C5=86=C5=A1?= Date: Wed, 11 Feb 2026 06:30:00 +0000 Subject: [PATCH] Update tiles.py --- tiles.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tiles.py b/tiles.py index e69de29..2f5e7e7 100644 --- a/tiles.py +++ b/tiles.py @@ -0,0 +1,25 @@ +import pygame +from settings import * + + +class Tile: + def __init__(self, id, name, solid, color, hardness=1.0, drop=None): + self.id = id + self.name = name + self.solid = solid + self.color = color + self.hardness = hardness + self.drop = drop # item id dropped when broken + + +# Register tiles here +TILE_TYPES = { + AIR: Tile(AIR, "Air", False, (0, 0, 0), hardness=0), + DIRT: Tile(DIRT, "Dirt", True, (139, 69, 19), hardness=0.3, drop=DIRT), + GRASS: Tile(GRASS, "Grass", True, (34, 177, 76), hardness=0.3, drop=DIRT), + STONE: Tile(STONE, "Stone", True, (100, 100, 100), hardness=0.8, drop=STONE), +} + + +def get_tile(tile_id): + return TILE_TYPES.get(tile_id, TILE_TYPES[AIR])