Compare commits

..

4 commits

5 changed files with 39 additions and 22 deletions

View file

@ -6,7 +6,7 @@
[resource]
script = ExtResource("2_61mgn")
scope = "instant"
scope = "turn"
type = "green"
effects = Array[ExtResource("1_fd50n")]([null])
name = "All-Out Attack"

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=3 uid="uid://bgc0u117jqyr1"]
[gd_scene load_steps=24 format=3 uid="uid://bgc0u117jqyr1"]
[ext_resource type="Script" path="res://demo_game.gd" id="1_jn16u"]
[ext_resource type="Script" path="res://player_side.gd" id="2_w4tnt"]
@ -159,7 +159,7 @@ offset_top = 24.0
offset_right = 251.0
offset_bottom = 47.0
grow_horizontal = 2
text = "HP: +0"
text = "HP +0"
[node name="HBoxContainer" type="HBoxContainer" parent="Own"]
visible = false
@ -281,7 +281,7 @@ offset_right = 251.0
offset_bottom = -29.0
grow_horizontal = 2
grow_vertical = 0
text = "HP: +0"
text = "HP +0"
[node name="StartGameButton" type="Button" parent="."]
layout_mode = 1

View file

@ -22,6 +22,7 @@ var match_manager: MatchManager
var show_buttons: bool
var signal_connected: bool
var selected_card: Control
var focused_card: Control
var hovering_cards_this_frame: Array[Control] = []
var hovering_cards_duration: Dictionary = {}
@ -42,12 +43,14 @@ func _ready():
support1_green.visible = false
support2_green.visible = false
support2_red.visible = false
incoming_damage_label.visible = false
for child in deck.get_children():
child.queue_free()
func _on_update(transition):
hovering_cards_duration.clear()
selected_card = null
incoming_damage_label.visible = true
for child in deck.get_children():
child.queue_free()
@ -128,6 +131,8 @@ func _on_update(transition):
_pop_this_card(monster_card)
play_card.emit(card))
monster_card.hovering.connect(func (delta): _do_hover(monster_card, delta))
monster_card.right_clicked.connect(func(): _do_zoom(monster_card))
monster_card.un_right_clicked.connect(_do_unzoom)
deck.add_child(monster_card)
elif card is SupportCard and card.type == "red":
@ -144,12 +149,28 @@ func _on_update(transition):
_pop_this_card(btn)
play_card.emit(card))
btn.hovering.connect(func (delta): _do_hover(btn, delta))
btn.right_clicked.connect(func(): _do_zoom(btn))
btn.un_right_clicked.connect(_do_unzoom)
if rps_button_container:
rps_button_container.visible = match_manager.phase == Match.Phase.RPS
for button: TextureButton in rps_button_container.get_children():
button.modulate = rps_grayed_color
func _do_zoom(card: Control):
if focused_card:
_do_unzoom()
var new_card: Control = card.duplicate()
get_parent().add_child(new_card)
new_card.set_anchors_and_offsets_preset(Control.PRESET_CENTER)
new_card.scale = Vector2(2,2)
focused_card = new_card
func _do_unzoom():
if focused_card:
focused_card.queue_free()
focused_card = null
func _pop_this_card(control: Control):
if selected_card:

View file

@ -3,6 +3,7 @@ class_name CardBase
signal left_clicked
signal right_clicked
signal un_right_clicked
signal hovering(delta: float)
@export var card_name_label: Label
@ -25,20 +26,17 @@ func _update(card: SupportCard):
func _process(delta):
var mouse_position = get_global_mouse_position()
var rect = get_global_rect()
if rect.has_point(mouse_position):
if rect.has_point(mouse_position) and get_window().has_focus():
hovering.emit(delta)
func _input(event):
if event is InputEventMouseButton:
if !event.is_pressed():
return
var mouse_position = get_global_mouse_position()
var rect = get_global_rect()
if not rect.has_point(mouse_position):
return
if event.button_index == MOUSE_BUTTON_LEFT:
if rect.has_point(mouse_position) and event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed() and get_window().has_focus():
left_clicked.emit()
elif event.button_index == MOUSE_BUTTON_RIGHT:
elif rect.has_point(mouse_position) and event.button_index == MOUSE_BUTTON_RIGHT and event.is_pressed() and get_window().has_focus():
right_clicked.emit()
elif event.button_index == MOUSE_BUTTON_RIGHT and !event.is_pressed():
un_right_clicked.emit()

View file

@ -3,6 +3,7 @@ class_name MonsterCardUI
signal left_clicked
signal right_clicked
signal un_right_clicked
signal hovering(delta: float)
@export var name_label : Label
@ -37,20 +38,17 @@ func show_monster(monster: MatchMonster):
func _process(delta):
var mouse_position = get_global_mouse_position()
var rect = get_global_rect()
if rect.has_point(mouse_position):
if rect.has_point(mouse_position) and get_window().has_focus():
hovering.emit(delta)
func _input(event):
if event is InputEventMouseButton:
if !event.is_pressed():
return
var mouse_position = get_global_mouse_position()
var rect = get_global_rect()
if not rect.has_point(mouse_position):
return
if event.button_index == MOUSE_BUTTON_LEFT:
if rect.has_point(mouse_position) and event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed() and get_window().has_focus():
left_clicked.emit()
elif event.button_index == MOUSE_BUTTON_RIGHT:
elif rect.has_point(mouse_position) and event.button_index == MOUSE_BUTTON_RIGHT and event.is_pressed() and get_window().has_focus():
right_clicked.emit()
elif event.button_index == MOUSE_BUTTON_RIGHT and !event.is_pressed():
un_right_clicked.emit()