|Attention||Topic was automatically imported from the old Question2Answer platform.|
I would like that when the player got close to the door and pressed a button, it would play an animation and it would change scene
func _process(delta): if input.is_action_pressed(“ui_accept”): get_tree().change_scene(“res://path/to/scene.tscn”)
You could do that with a Tween. In your process function instead of immediately calling the change scene function you could call an intermediary function… something like animate scene change:
func AnimateSceneChange(pathToScene: String) -> void: 'Tween code here...
I notice you’re using 3.4, if you’re willing to upgrade to 3.5 you’ll get access to the new SceneTreeTween class which I personally think is a much better and more logical implementation. See the docs here. https://docs.godotengine.org/en/stable/classes/class_scenetreetween.html
But if you prefer to stick with 3.4, you can easily connect the Tween All Completed signal to another function which would finally call the Change Scene function. Hope this makes sense.
dacess123 | 2022-08-16 19:02