This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hello, sorry if i didnt explain well in the title, but i am making a slime kind enemy, im trying to make it divide after being shot, and then reduce his size, ive already solved the size thing, but im having problems into make it divide, i saw a post in godot related to this and i used
var Slime = PackedScene.new() Slime.pack(self) var slime = Slime.instance() var scene_root = get_parent() scene_root.add_child(slime)
It does divide the slime, but it ends with a small one and a normal size one, the question is, how can i store the size variable to replicate it in the child? sorry i think i still cant explain myself well.

Godot version 3.3.2
in Engine by (37 points)

2 Answers

+1 vote

Assuming original_slime is pointing to the original slime node which is now resized and new_slime is pointing to the new slime you just added, and you've used scale to resize it:

new_slime.scale= original_slime.scale

by (115 points)
+1 vote

Maybe you could add a bool variable to the slime's script called "isBigSlime". This variable will be set as true by default. Then, you could change this variable to false when you create a smaller slime instance of it. You could use this bool in the _ready function to rescale it when it is false.

by (345 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.