Compare commits
4 commits
win-lose-t
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e8dc34646 | ||
|
|
83df3047f7 | ||
| 72a1418914 | |||
| e7c0782099 |
5 changed files with 39 additions and 22 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("2_61mgn")
|
script = ExtResource("2_61mgn")
|
||||||
scope = "instant"
|
scope = "turn"
|
||||||
type = "green"
|
type = "green"
|
||||||
effects = Array[ExtResource("1_fd50n")]([null])
|
effects = Array[ExtResource("1_fd50n")]([null])
|
||||||
name = "All-Out Attack"
|
name = "All-Out Attack"
|
||||||
|
|
|
||||||
|
|
@ -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://demo_game.gd" id="1_jn16u"]
|
||||||
[ext_resource type="Script" path="res://player_side.gd" id="2_w4tnt"]
|
[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_right = 251.0
|
||||||
offset_bottom = 47.0
|
offset_bottom = 47.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
text = "HP: +0"
|
text = "HP +0"
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="Own"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="Own"]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
@ -281,7 +281,7 @@ offset_right = 251.0
|
||||||
offset_bottom = -29.0
|
offset_bottom = -29.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
text = "HP: +0"
|
text = "HP +0"
|
||||||
|
|
||||||
[node name="StartGameButton" type="Button" parent="."]
|
[node name="StartGameButton" type="Button" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ var match_manager: MatchManager
|
||||||
var show_buttons: bool
|
var show_buttons: bool
|
||||||
var signal_connected: bool
|
var signal_connected: bool
|
||||||
var selected_card: Control
|
var selected_card: Control
|
||||||
|
var focused_card: Control
|
||||||
|
|
||||||
var hovering_cards_this_frame: Array[Control] = []
|
var hovering_cards_this_frame: Array[Control] = []
|
||||||
var hovering_cards_duration: Dictionary = {}
|
var hovering_cards_duration: Dictionary = {}
|
||||||
|
|
@ -42,12 +43,14 @@ func _ready():
|
||||||
support1_green.visible = false
|
support1_green.visible = false
|
||||||
support2_green.visible = false
|
support2_green.visible = false
|
||||||
support2_red.visible = false
|
support2_red.visible = false
|
||||||
|
incoming_damage_label.visible = false
|
||||||
for child in deck.get_children():
|
for child in deck.get_children():
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
||||||
func _on_update(transition):
|
func _on_update(transition):
|
||||||
hovering_cards_duration.clear()
|
hovering_cards_duration.clear()
|
||||||
selected_card = null
|
selected_card = null
|
||||||
|
incoming_damage_label.visible = true
|
||||||
|
|
||||||
for child in deck.get_children():
|
for child in deck.get_children():
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
@ -128,6 +131,8 @@ func _on_update(transition):
|
||||||
_pop_this_card(monster_card)
|
_pop_this_card(monster_card)
|
||||||
play_card.emit(card))
|
play_card.emit(card))
|
||||||
monster_card.hovering.connect(func (delta): _do_hover(monster_card, delta))
|
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)
|
deck.add_child(monster_card)
|
||||||
|
|
||||||
elif card is SupportCard and card.type == "red":
|
elif card is SupportCard and card.type == "red":
|
||||||
|
|
@ -144,12 +149,28 @@ func _on_update(transition):
|
||||||
_pop_this_card(btn)
|
_pop_this_card(btn)
|
||||||
play_card.emit(card))
|
play_card.emit(card))
|
||||||
btn.hovering.connect(func (delta): _do_hover(btn, delta))
|
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:
|
if rps_button_container:
|
||||||
rps_button_container.visible = match_manager.phase == Match.Phase.RPS
|
rps_button_container.visible = match_manager.phase == Match.Phase.RPS
|
||||||
for button: TextureButton in rps_button_container.get_children():
|
for button: TextureButton in rps_button_container.get_children():
|
||||||
button.modulate = rps_grayed_color
|
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):
|
func _pop_this_card(control: Control):
|
||||||
if selected_card:
|
if selected_card:
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ class_name CardBase
|
||||||
|
|
||||||
signal left_clicked
|
signal left_clicked
|
||||||
signal right_clicked
|
signal right_clicked
|
||||||
|
signal un_right_clicked
|
||||||
signal hovering(delta: float)
|
signal hovering(delta: float)
|
||||||
|
|
||||||
@export var card_name_label: Label
|
@export var card_name_label: Label
|
||||||
|
|
@ -25,20 +26,17 @@ func _update(card: SupportCard):
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var mouse_position = get_global_mouse_position()
|
var mouse_position = get_global_mouse_position()
|
||||||
var rect = get_global_rect()
|
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)
|
hovering.emit(delta)
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if !event.is_pressed():
|
|
||||||
return
|
|
||||||
|
|
||||||
var mouse_position = get_global_mouse_position()
|
var mouse_position = get_global_mouse_position()
|
||||||
var rect = get_global_rect()
|
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()
|
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()
|
right_clicked.emit()
|
||||||
|
elif event.button_index == MOUSE_BUTTON_RIGHT and !event.is_pressed():
|
||||||
|
un_right_clicked.emit()
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ class_name MonsterCardUI
|
||||||
|
|
||||||
signal left_clicked
|
signal left_clicked
|
||||||
signal right_clicked
|
signal right_clicked
|
||||||
|
signal un_right_clicked
|
||||||
signal hovering(delta: float)
|
signal hovering(delta: float)
|
||||||
|
|
||||||
@export var name_label : Label
|
@export var name_label : Label
|
||||||
|
|
@ -37,20 +38,17 @@ func show_monster(monster: MatchMonster):
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var mouse_position = get_global_mouse_position()
|
var mouse_position = get_global_mouse_position()
|
||||||
var rect = get_global_rect()
|
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)
|
hovering.emit(delta)
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if !event.is_pressed():
|
|
||||||
return
|
|
||||||
|
|
||||||
var mouse_position = get_global_mouse_position()
|
var mouse_position = get_global_mouse_position()
|
||||||
var rect = get_global_rect()
|
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()
|
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()
|
right_clicked.emit()
|
||||||
|
elif event.button_index == MOUSE_BUTTON_RIGHT and !event.is_pressed():
|
||||||
|
un_right_clicked.emit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue