#openable and closeable door
1 messages · Page 1 of 1 (latest)
ups ı deleted my message
Everything is ok in these codes, but when you press the interact button (e), the game immediately crashes and closes.
Game: I'm trying to make a 3D game and a door that can be opened and closed.
you need to create a new tween every time you tween something
how ?
also, the new way of connecting signals is signal.connect(function), no need for messy strings
tween = create_tween()
Do you want me to post the code here?
there are no Tween nodes anymore
there is just renaming a Node3D, it does not make it a tween
just change your variable to var tween:Tween
But in Godot4, we cannot add tween directly from the hierarchy.
then before you tween anything you do
if tween: tween.kill()
tween = create_tween()
exactly, what you did pointless. Tweens live and die in code now
Do I need to write this every time, for example 13, 18,23. to the lines
yes
you could create a function as well
and just call your target degree
func rotate_door(p_degrees):
if tween: tween.kill()
tween = create_tween()
tween.tween_property(self, "rotation_degree", p_degrees, 2.0)
and then call that instead
with the target degrees
that is up to you
Thank you for your help Thiago, my biggest mistake is that I tried to make a game in 3 days, the basic mechanics are easy, but I don't understand such things right now, so I watch tutorial videos, but they are very insufficient, I don't know how to gain this knowledge.
🥲
you have to be sure you undersand what the code is doing
definitly