diff --git a/data/cards/support/all_out_attack.tres b/data/cards/support/all_out_attack.tres index 0269e6f..660a217 100644 --- a/data/cards/support/all_out_attack.tres +++ b/data/cards/support/all_out_attack.tres @@ -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" diff --git a/demo_game.tscn b/demo_game.tscn index ee48333..b4261af 100644 --- a/demo_game.tscn +++ b/demo_game.tscn @@ -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 diff --git a/player_side.gd b/player_side.gd index 169c355..5a88280 100644 --- a/player_side.gd +++ b/player_side.gd @@ -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,13 +149,29 @@ 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: selected_card.position = Vector2(selected_card.position.x, original_hover_position) diff --git a/ui/card_template/card_base.gd b/ui/card_template/card_base.gd index 96bc2d1..2e623c6 100644 --- a/ui/card_template/card_base.gd +++ b/ui/card_template/card_base.gd @@ -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() diff --git a/ui/card_template/monster_card.gd b/ui/card_template/monster_card.gd index 8c1ca87..1c154f6 100644 --- a/ui/card_template/monster_card.gd +++ b/ui/card_template/monster_card.gd @@ -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()