connect resizing of player and object
This commit is contained in:
parent
fb7a9c3852
commit
1734ce0c47
3 changed files with 44 additions and 50 deletions
|
@ -1,24 +1,28 @@
|
|||
extends StaticBody2D
|
||||
|
||||
@export var scale_up_target: Vector2 = Vector2(3.0, 3.0)
|
||||
@export var scale_down_target: Vector2 = Vector2(0.5, 0.5)
|
||||
@export var scale_duration: float = 0.5
|
||||
@export var scale_up_target: Vector2 = Vector2(3.0, 3.0)
|
||||
@export var scale_down_target: Vector2 = Vector2(0.5, 0.5)
|
||||
@export var scale_duration: float = 0.5
|
||||
@export var ui_actions: Node
|
||||
|
||||
func _ready():
|
||||
if ui_actions == null:
|
||||
ui_actions = get_parent().get_node("Path/To/UiActionsNode")
|
||||
|
||||
func _on_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
if event.is_action_pressed("click"):
|
||||
if ui_actions.current_selected == "scale_up":
|
||||
scale_up()
|
||||
ui_actions.scale_up_player()
|
||||
elif ui_actions.current_selected == "scale_down":
|
||||
scale_down()
|
||||
ui_actions.scale_down_player()
|
||||
|
||||
func scale_up():
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "scale", scale_up_target, scale_duration)
|
||||
# TODO: scale the player
|
||||
|
||||
func scale_down():
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "scale", scale_down_target, scale_duration)
|
||||
# TODO: scale the player
|
||||
|
||||
func _on_input_event(viewport, event, shape_idx):
|
||||
print("works")
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
if Input.is_action_just_pressed("click"):
|
||||
scale_up()
|
||||
elif Input.is_action_just_pressed("clickR"):
|
||||
scale_down()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue