Resize character on keypress?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By squeakybadger


I’m new to Godot, so this might seem a simple question, but how do I go about changing the scale/size of the player controlled character via a keypress?

Searching for scale just seems to bring up the wrong kind of scaling for gscript that I think I need.


:bust_in_silhouette: Reply From: rk3Omega

You’d modify the scale variable. However it is a Vector2, so you’ll have to set/modify it with a Vector2, or modify the Vector2’s values:

var scale_speed = .5

func _process(delta):
	if Input.is_action_pressed("ui_down"):
		scale -= scale_speed * delta * Vector2(1, 1)
	if Input.is_action_pressed("ui_up"):
		scale.x -= scale_speed * delta
		scale.y += scale_speed * delta
	if Input.is_action_pressed("ui_accept"):
		scale = Vector2(1, 1)