diff --git a/project.godot b/project.godot index cbfa5e6..8f952e3 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,7 @@ config/icon="res://icon.svg" [autoload] GameplaySignalBus="*uid://cqh0t2i1slf8u" +TurnSchedule="*uid://cbrs61uy1wkwe" [debug] diff --git a/scenes/game.tscn b/scenes/game.tscn index 7fee7ea..06349c8 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,6 +1,8 @@ [gd_scene format=3 uid="uid://bxt4kgs6px3t8"] [ext_resource type="Texture2D" uid="uid://b2pm032d5tqwb" path="res://sprites/field.png" id="1_iywne"] +[ext_resource type="AudioStream" uid="uid://bdykhfqrftuvv" path="res://music/fostral.wav" id="1_trtic"] +[ext_resource type="AudioStream" uid="uid://cuiseagt5rk7h" path="res://music/glorx.wav" id="2_ir15t"] [ext_resource type="PackedScene" uid="uid://dl3ve6prnn2m6" path="res://cards/card.tscn" id="2_p57ef"] [ext_resource type="Script" uid="uid://caf4h6lok18so" path="res://ui/hand.gd" id="2_u5sy4"] [ext_resource type="Resource" uid="uid://e7kiu3wcf0ff" path="res://cards/resources/fosma.tres" id="3_u5sy4"] @@ -11,8 +13,19 @@ [ext_resource type="Script" uid="uid://dgd30yiw5q368" path="res://systems/grid_reciever.gd" id="9_0tnpc"] [ext_resource type="Script" uid="uid://bkh50fstwbb6s" path="res://systems/grid_arranger.gd" id="10_vtaks"] +[sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_trtic"] +shuffle = true +stream_count = 4 +stream_0 = ExtResource("1_trtic") +stream_1 = ExtResource("2_ir15t") + [node name="Game" type="Node2D" unique_id=619820575] +[node name="MusicPlayer" type="AudioStreamPlayer" parent="." unique_id=1956514678] +stream = SubResource("AudioStreamPlaylist_trtic") +volume_db = -20.0 +autoplay = true + [node name="Field" type="Sprite2D" parent="." unique_id=1104378711] texture = ExtResource("1_iywne") centered = false @@ -20,26 +33,30 @@ metadata/_edit_lock_ = true [node name="PlayerInterface" type="CanvasLayer" parent="." unique_id=269857956] -[node name="Hand" type="Control" parent="PlayerInterface" unique_id=403305026] +[node name="Hand" type="Control" parent="PlayerInterface" unique_id=903928048] layout_mode = 3 -anchors_preset = 12 -anchor_top = 1.0 +anchors_preset = 14 +anchor_top = 0.5 anchor_right = 1.0 -anchor_bottom = 1.0 +anchor_bottom = 0.5 +offset_top = 786.0 +offset_bottom = 786.0 grow_horizontal = 2 -grow_vertical = 0 -pivot_offset_ratio = Vector2(0.5, 0.5) +grow_vertical = 2 +pivot_offset_ratio = Vector2(0.5, 0) script = ExtResource("2_u5sy4") +radius = 512.0 +arch = 1.0789625435828945 [node name="Card" parent="PlayerInterface/Hand" unique_id=267582807 instance=ExtResource("2_p57ef")] layout_mode = 0 anchors_preset = 0 anchor_right = 0.0 anchor_bottom = 0.0 -offset_left = 733.9999 -offset_top = -168.99997 -offset_right = 846.9999 -offset_bottom = 3.0517578e-05 +offset_left = 532.9398 +offset_top = -437.81183 +offset_right = 645.9399 +offset_bottom = -268.81158 card_resource = ExtResource("3_u5sy4") [node name="Card2" parent="PlayerInterface/Hand" unique_id=1229293312 instance=ExtResource("2_p57ef")] @@ -47,10 +64,10 @@ layout_mode = 0 anchors_preset = 0 anchor_right = 0.0 anchor_bottom = 0.0 -offset_left = 846.9999 -offset_top = -168.99997 -offset_right = 959.99994 -offset_bottom = 3.0517578e-05 +offset_left = 767.06165 +offset_top = -577.98645 +offset_right = 880.06165 +offset_bottom = -408.98608 card_resource = ExtResource("4_gee14") [node name="Card4" parent="PlayerInterface/Hand" unique_id=1427311772 instance=ExtResource("2_p57ef")] @@ -58,10 +75,10 @@ layout_mode = 0 anchors_preset = 0 anchor_right = 0.0 anchor_bottom = 0.0 -offset_left = 959.9999 -offset_top = -168.99997 -offset_right = 1072.9999 -offset_bottom = 3.0517578e-05 +offset_left = 1039.9382 +offset_top = -577.9866 +offset_right = 1152.9384 +offset_bottom = -408.9859 card_resource = ExtResource("3_u5sy4") [node name="Card3" parent="PlayerInterface/Hand" unique_id=1907397406 instance=ExtResource("2_p57ef")] @@ -69,10 +86,10 @@ layout_mode = 0 anchors_preset = 0 anchor_right = 0.0 anchor_bottom = 0.0 -offset_left = 1072.9998 -offset_top = -168.99997 -offset_right = 1185.9998 -offset_bottom = 3.0517578e-05 +offset_left = 1274.06 +offset_top = -437.81183 +offset_right = 1387.06 +offset_bottom = -268.8116 card_resource = ExtResource("5_0tnpc") [node name="Grid" type="Node2D" parent="." unique_id=1478060666 node_paths=PackedStringArray("right_border_marker")] diff --git a/sprites/clock.png b/sprites/clock.png new file mode 100644 index 0000000..3f81940 Binary files /dev/null and b/sprites/clock.png differ diff --git a/sprites/clock.png.import b/sprites/clock.png.import new file mode 100644 index 0000000..955547e --- /dev/null +++ b/sprites/clock.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dp5k3rw7qywtr" +path="res://.godot/imported/clock.png-66af4231b30943e4cee6caf99906e470.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/clock.png" +dest_files=["res://.godot/imported/clock.png-66af4231b30943e4cee6caf99906e470.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/sprites/clock.png~ b/sprites/clock.png~ new file mode 100644 index 0000000..ad5cc5e Binary files /dev/null and b/sprites/clock.png~ differ diff --git a/systems/turn_schedule.gd b/systems/turn_schedule.gd new file mode 100644 index 0000000..db9e419 --- /dev/null +++ b/systems/turn_schedule.gd @@ -0,0 +1,30 @@ +extends Node + +var current_team: TEAMS = TEAMS.Enemy +var game_round: int = 0 +var turn: int = 0 + +func reset() -> void: + current_team = TEAMS.Enemy + +func advance() -> void: + trigger_units.emit(current_team) + current_team = clamp(current_team + 1,TEAMS.Player,TEAMS.Enemy) + turn += 1 + if current_team == TEAMS.Player: + game_round += 1 + turn = 0 + trigger_effects.emit() + next_round.emit() + next_turn.emit() + +signal trigger_effects +signal trigger_units(team: TEAMS) +signal next_turn +signal next_round + +enum TEAMS { + Player, + Neutrals, + Enemy +} diff --git a/systems/turn_schedule.gd.uid b/systems/turn_schedule.gd.uid new file mode 100644 index 0000000..33fb76c --- /dev/null +++ b/systems/turn_schedule.gd.uid @@ -0,0 +1 @@ +uid://cbrs61uy1wkwe diff --git a/ui/hand.gd b/ui/hand.gd index bd78ac0..1e3121b 100644 --- a/ui/hand.gd +++ b/ui/hand.gd @@ -1,27 +1,16 @@ @tool extends Control +@export var radius: float = 10. +@export_range(0,360,0.01,"or_greater","radians_as_degrees") var arch: float = PI/6 -# Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta: float) -> void: - var calculated_size: Vector2 = Vector2.ZERO - - for card: Card in get_children(): - calculated_size += card.get_rect().size - - calculated_size.y /= get_child_count() - - var offset: float = 0. for i in range(get_child_count()): - var card:Card = get_child(i) - offset += card.get_rect().size.x - if card.top_level: + var child: Card = get_child(i) + if child.top_level: continue - var calculated_position: Vector2 = get_combined_pivot_offset() - calculated_size * Vector2(1.-1./get_child_count(),1) + Vector2.RIGHT*offset - - card.position = lerp(card.position,calculated_position,0.25) - -func resort_by_position(): - var children: Array = get_children() + var angle: float = -arch+2*arch*((float(i+0.5))/get_child_count()) + var pointing_up: float = angle - PI/2 + child.position = lerp(child.position,get_combined_pivot_offset()+Vector2.from_angle(pointing_up) * radius-child.get_combined_pivot_offset(),0.25)