ChessBuilder/Systems/Tiles/FireWall.gd

41 lines
No EOL
1.4 KiB
GDScript

class_name FireWallTile
extends Tile
func _init(button: Button, is_white: bool) -> void:
super._init(button, is_white)
tile_name = "Fire Wall"
description = "Captures any piece that moves through"
type = TileType.GENERAL
duration = 3
func apply_effect(piece: Pawn = null) -> void:
if piece && is_effect_active():
# Get the parent container and remove the piece
var container = piece.get_parent() as PieceContainer
if container:
var board = container.get_parent().get_parent() as ChessGame
board.updatePoints(piece)
container.remove_piece()
func update_appearance() -> void:
if is_effect_active() && base_button:
var style = StyleBoxFlat.new()
var tile_color = Color(1, 0.4, 0) # Orange for fire
var base_color = Color(0.8, 0.8, 0.8) if base_is_white else Color(0.2, 0.2, 0.2)
style.bg_color = Color(
(base_color.r + tile_color.r) / 2,
(base_color.g + tile_color.g) / 2,
(base_color.b + tile_color.b) / 2
)
# Add overlay effect for fire
var overlay = ColorRect.new()
overlay.name = "FireOverlay"
overlay.color = Color(1, 0.4, 0, 0.3) # Semi-transparent orange
overlay.size = base_button.size
overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE
base_button.add_child(overlay)
else:
restore_base_appearance()