Draw
This commit is contained in:
parent
8723c4e6df
commit
1bedba2c6b
5 changed files with 38 additions and 47 deletions
|
|
@ -3,14 +3,11 @@
|
|||
[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"]
|
||||
[ext_resource type="Resource" uid="uid://djqlx7bmcs5gj" path="res://cards/resources/doh.tres" id="4_gee14"]
|
||||
[ext_resource type="Resource" uid="uid://b6kiwb0marpng" path="res://cards/resources/zlosma.tres" id="5_0tnpc"]
|
||||
[ext_resource type="Script" uid="uid://rt6mxr30u8tp" path="res://systems/grid.gd" id="7_u5sy4"]
|
||||
[ext_resource type="Script" uid="uid://bmy5djjmiljhl" path="res://systems/grid_highlighter.gd" id="8_gee14"]
|
||||
[ext_resource type="Script" uid="uid://dgd30yiw5q368" path="res://systems/grid_reciever.gd" id="9_0tnpc"]
|
||||
[ext_resource type="Script" uid="uid://h5e6xh30ni5n" path="res://ui/debug_gameplay_buttons.gd" id="9_kvuet"]
|
||||
[ext_resource type="Script" uid="uid://bkh50fstwbb6s" path="res://systems/grid_arranger.gd" id="10_vtaks"]
|
||||
|
||||
[sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_trtic"]
|
||||
|
|
@ -48,49 +45,26 @@ 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 = 532.9398
|
||||
offset_top = -437.81183
|
||||
offset_right = 645.9399
|
||||
offset_bottom = -268.81158
|
||||
card_resource = ExtResource("3_u5sy4")
|
||||
[node name="Control" type="Control" parent="PlayerInterface" unique_id=1188494258]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("9_kvuet")
|
||||
|
||||
[node name="Card2" parent="PlayerInterface/Hand" unique_id=1229293312 instance=ExtResource("2_p57ef")]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PlayerInterface/Control" unique_id=1060171104]
|
||||
layout_mode = 0
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_left = 767.06165
|
||||
offset_top = -577.98645
|
||||
offset_right = 880.06165
|
||||
offset_bottom = -408.98608
|
||||
card_resource = ExtResource("4_gee14")
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Card4" parent="PlayerInterface/Hand" unique_id=1427311772 instance=ExtResource("2_p57ef")]
|
||||
layout_mode = 0
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
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")]
|
||||
layout_mode = 0
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_left = 1274.06
|
||||
offset_top = -437.81183
|
||||
offset_right = 1387.06
|
||||
offset_bottom = -268.8116
|
||||
card_resource = ExtResource("5_0tnpc")
|
||||
[node name="DrawCard" type="Button" parent="PlayerInterface/Control/VBoxContainer" unique_id=1058516143]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "Draw card"
|
||||
|
||||
[node name="Grid" type="Node2D" parent="." unique_id=1478060666 node_paths=PackedStringArray("right_border_marker")]
|
||||
position = Vector2(398, 162)
|
||||
|
|
@ -116,3 +90,5 @@ position = Vector2(801, 567)
|
|||
position = Vector2(0, 142)
|
||||
anchor_mode = 0
|
||||
zoom = Vector2(1.5, 1.5)
|
||||
|
||||
[connection signal="pressed" from="PlayerInterface/Control/VBoxContainer/DrawCard" to="PlayerInterface/Control" method="_on_draw_card_pressed"]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ var current_team: TEAMS = TEAMS.Enemy
|
|||
var game_round: int = 0
|
||||
var turn: int = 0
|
||||
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
current_team = TEAMS.Enemy
|
||||
|
||||
|
|
|
|||
6
ui/debug_gameplay_buttons.gd
Normal file
6
ui/debug_gameplay_buttons.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extends Control
|
||||
|
||||
const CARDS = [preload("uid://djqlx7bmcs5gj"), preload("uid://e7kiu3wcf0ff"), preload("uid://b6kiwb0marpng")]
|
||||
|
||||
func _on_draw_card_pressed() -> void:
|
||||
GameplaySignalBus.draw_card.emit(CARDS.pick_random())
|
||||
1
ui/debug_gameplay_buttons.gd.uid
Normal file
1
ui/debug_gameplay_buttons.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://h5e6xh30ni5n
|
||||
|
|
@ -5,12 +5,16 @@ const CARD_SCENE = preload("uid://dl3ve6prnn2m6")
|
|||
|
||||
@export var radius: float = 10.
|
||||
@export_range(0,360,0.01,"or_greater","radians_as_degrees") var arch: float = PI/6
|
||||
@export var rotate_cards: bool = true
|
||||
|
||||
func _ready() -> void:
|
||||
GameplaySignalBus.draw_card.connect(draw_card)
|
||||
|
||||
func draw_card(card_resource: CardResource):
|
||||
var card: Card =
|
||||
var card: Card = CARD_SCENE.instantiate()
|
||||
|
||||
card.card_resource = card_resource
|
||||
add_child(card)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
for i in range(get_child_count()):
|
||||
|
|
@ -21,3 +25,5 @@ func _process(_delta: float) -> void:
|
|||
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)
|
||||
if rotate_cards:
|
||||
child.rotation = lerp(child.rotation,angle,0.25)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue