33 lines
No EOL
1.1 KiB
GDScript
33 lines
No EOL
1.1 KiB
GDScript
class_name DoubleWallTile
|
|
extends Tile
|
|
|
|
func _init(button: Button, is_white: bool, d: int, owner: TileOwner = TileOwner.GAME) -> void:
|
|
super._init(button, is_white, d)
|
|
tile_name = "Double Wall"
|
|
description = "No Peice can pass or jump this tile"
|
|
type = TileType.GENERAL
|
|
duration = d
|
|
tile_owner = owner
|
|
passable = false
|
|
jumpable = false
|
|
|
|
func apply_effect(_piece: Pawn = null) -> void:
|
|
return
|
|
|
|
func update_appearance() -> void:
|
|
if is_effect_active() && base_button:
|
|
var style = StyleBoxFlat.new()
|
|
var tile_color = Utils.DOUBLE_WALL
|
|
var base_color = Utils.LIGHT_CELL if base_is_white else Utils.DARK_CELL
|
|
|
|
# Blend the tile effect color with the base chess board color
|
|
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
|
|
)
|
|
|
|
# Apply the style using theme override
|
|
base_button.add_theme_stylebox_override("normal", style)
|
|
else:
|
|
restore_base_appearance() |