Working prototype

This commit is contained in:
Sch1nken 2024-03-16 19:56:22 +01:00
parent 3de181134d
commit 1ed0ec226d
24 changed files with 682 additions and 31 deletions

29
TurnTexture.gd Normal file
View file

@ -0,0 +1,29 @@
extends Control
const HEX_BLACK = preload("res://UI/hex_black.svg")
const HEX_WHITE = preload("res://UI/hex_white.svg")
@onready var texture_rect: TextureRect = $TextureRect
# Called when the node enters the scene tree for the first time.
func _ready():
GameEvents.turn_started.connect(_on_turn_started)
pass # Replace with function body.
func _on_turn_started(turn_num: int, map: HexGrid, is_blacks_turn: bool) -> void:
print("turn started")
print(multiplayer.is_server())
var new_texture = HEX_WHITE
if is_blacks_turn:
new_texture = HEX_BLACK
var tween = get_tree().create_tween()
tween.tween_property(self, "scale", Vector2(0.0, 0.0), 0.5).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_ELASTIC)
tween.tween_property(texture_rect, "texture", new_texture, 0.0)
tween.tween_property(self, "scale", Vector2(0.1, 0.1), 0.5).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_ELASTIC)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
rotation += delta * PI / 12.0
pass