Godot Version
Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org
Question
Basically the title…
Started to learn gamedev from 0 couple of weeks ago, so i have really limited knowledge about coding and Godot itself
I’m trying to make separate explosion scene, which i will instantiate by other scripts and pass through “explosion power”, so explosion radius would be different, depending on that “power”
So far my code looks like this:
extends Area2D
class_name explosion2D
@onready var expl_shape: CollisionShape2D = $ExplosionShape
# blank variables
var base_damage : float # not used
var expl_rad : float
func boom(
shell_expl_pow : float,
):
print("RECIEVED shell_expl_pow: " + str(shell_expl_pow))
expl_rad = shell_expl_pow * 15
self.scale = Vector2(expl_rad, expl_rad)
As you can see, currently i’m trying to use scale (CollisionShape2D’s CircleShape2D is scaled to 1px manually), but that gives unstable results somehow: https://youtu.be/Fvx_nDcXvDc
How can i change CircleShape2D by script?
I’ve tried to use radius property, but didn’t manage to wrap my head arround, how to properly use it… And the only simillar topic i found was from 2020, so probably Godot ver 3.x was used and i guess something was changed since…
Thanks in advance for any help