0 votes

For some reason my second scene overlaps my first scene during scene transition and all collisions remain from first scene. Im a beginner please help

tool

extends Area2D

export(String, FILE) var nextscenepath = ""
export(Vector2) var playerspawnlocation = Vector2.ZERO

func getconfigurationwarning() -> String:
if next
scenepath == "":
return "next
scene path must be set for portal to work"
else:
return ""

func onPortalbodyentered(body):
Global.playerinitialmapposition = playerspawnlocation
if get
tree().changescene(nextscenepath) == OK:
queue
free()
else:
print("err")

Godot version 3.2.3
in Engine by (16 points)

2 Answers

0 votes
get_tree().change_scene()

Already removed the current scene, so you don't need to call queue_free(). I'm not 100% sure this is the problem, but you should start with that.

by (605 points)

Hey thanks,
I tried that but it didn't work.
But using
get.parent().queuefree()
seemed to work

0 votes

Found the solution if anyone else is a noob like me.
getparent().queuefree()
works

by (16 points)
reshown by
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 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 webmaster@godotengine.org with your username.