![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | pafos_kota |
There’s a code
#---------------------------------FIRST VER-----------------------#
func _process(delta):
yield(get_tree().create_timer(1), "timeout") #-----> not necessarily
$lighter/AnimationPlayer.play("light_break")
Works perfectly well until I try to start from “menu” scene. Player starts lag and nothing is happens on scene. That’s in second room, first works brilliant. And it also works perfectly when player moves from scene to scene.
Also i tried to give other scene and start from the menu, but… then player doesn’t even contact with it.
here’s the trigger code:
func _physics_process(delta):
var bodies = get_overlapping_bodies()
for body in bodies:
if body.name == "frisk":
get_tree().change_scene("*some_scene*")
What can i do with it?
To help with the “lagging” part, instead of using get_overlapping_bodies()
, use signals instead. The function get_overlapping_bodies()
can be process-intensive, and so can lead to sluggish frames.
Ertain | 2021-04-14 20:04
Agreed get_overlapping_bodies()
should only ever be used as a test case and not in the way it is here
Wakatta | 2021-04-14 23:41
thanks a lot
pafos_kota | 2021-04-16 13:39