scaling objects or the player works
This commit is contained in:
parent
2c08e2d99c
commit
138d4c2cfb
9 changed files with 95 additions and 27 deletions
|
@ -64,3 +64,7 @@ func Jump():
|
|||
|
||||
func _on_hurtbox_body_entered(body: Node2D) -> void:
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
|
||||
func _on_area_2d_body_entered(body):
|
||||
print("Body entered")
|
||||
|
|
24
gmtk_2024/scripts/resizable_block.gd
Normal file
24
gmtk_2024/scripts/resizable_block.gd
Normal file
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
|
||||
|
||||
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()
|
|
@ -4,6 +4,9 @@ extends Node
|
|||
|
||||
var current_selected = "none";
|
||||
|
||||
@export var scale_duration: float = 0.5
|
||||
var target_scale: Vector2 = Vector2(1, 1)
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("click"):
|
||||
|
@ -25,10 +28,18 @@ func select_mirror():
|
|||
current_selected = "mirror"
|
||||
|
||||
func scale_up():
|
||||
pass #Hir hochscalieren einbauen
|
||||
if player:
|
||||
target_scale = Vector2(3.0, 3.0)
|
||||
start_scaling()
|
||||
|
||||
func scale_down():
|
||||
pass #Hir runterscalieren einbauen
|
||||
|
||||
if player:
|
||||
target_scale = Vector2(0.5, 0.5)
|
||||
start_scaling()
|
||||
|
||||
func start_scaling():
|
||||
var tween = create_tween()
|
||||
tween.tween_property(player, "scale", target_scale, scale_duration)
|
||||
|
||||
func mirror():
|
||||
pass #Hir mirror einbauen einbauen
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue