Dodge The Creeps randomly scaling the sprite through code

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

i tried scaling through resize but i doesnt seem to do the trick

extends RigidBody2D

export var min_speed = 150
export var max_speed = 250

func _ready():

var mob_types = $AnimatedSprite.frames.get_animation_names()

var rnsc = $AnimatedSprite.transform.scaled(Vector2(10,10))

print(rnsc.get_scale())

`$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]`
:bust_in_silhouette: Reply From: ramazan

This = var rnsc = $AnimatedSprite.transform.scaled(Vector2(10,10)) //

var rnsc = $AnimatedSprite.set_scale(Vector2(10,10))

thank you so much i ve been searching 2 days now and couldnt figure it out

bilkar | 2022-01-29 08:47

You are welcome
The Inspector — Godot Engine (latest) documentation in English

look node/inspector/Transform/scale
Move the mouse over the “scale” and wait.
shows how to use there

And
look inspector right. “Doc” = “document” (Help)

ramazan | 2022-01-29 08:54