feat: new cards in game
This commit is contained in:
parent
2c4e9d90f3
commit
5af462e78d
14 changed files with 700 additions and 123 deletions
|
|
@ -1,4 +1,9 @@
|
|||
extends Control
|
||||
class_name CardBase
|
||||
|
||||
signal left_clicked
|
||||
signal right_clicked
|
||||
signal hovering(delta: float)
|
||||
|
||||
@export var card_name_label: Label
|
||||
@export var card_desc_label: Label
|
||||
|
|
@ -17,4 +22,23 @@ func _update(card: SupportCard):
|
|||
card_desc_label.text = card.description
|
||||
icon_rect.texture = card.icon
|
||||
|
||||
|
||||
func _process(delta):
|
||||
var mouse_position = get_global_mouse_position()
|
||||
var rect = get_global_rect()
|
||||
if rect.has_point(mouse_position):
|
||||
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:
|
||||
left_clicked.emit()
|
||||
elif event.button_index == MOUSE_BUTTON_RIGHT:
|
||||
right_clicked.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue