What result do you want?
How do you make the player teleport
- Edited
DaveTheCoder
I want the object to teleport the player somewhere (not another scene, but location on the scene the player is in), but the object isn't doing that when the player enters collison.
- Edited
CinnaBreadDude It's still not working, it's making the player go over the object.
Is that the only problem? What do you want the player to do instead?
DaveTheCoder
It doesn't teleport the player, like I wanted it to. That's the issue.
CinnaBreadDude answer in detail how you want the player to teleport
- Edited
godol
I put a collision in area2d
The collision doesn't work though
- Edited
It would save a lot of time if you could post a .zip of your project, or a minimal project that illustrates the problem, along with a clearer explanation of the problem.
I imported the project into Godot 3.5.1. What steps do I perform to see the problem?
DaveTheCoder
do you see the icon png in mountain enterence? When you touch it, its suposed to teleport you to the start of the level. Also just need to know, do you see the photo in this reply?
- Edited
Yes, I see the bottom portion of the scene tree in the image in your reply, and the attached script (Spike.gd). I'm attaching a screenshot of the running game (I turned off full-screen).
I'm not sure what you mean by "icon png in mountain entrance". Is that the animated player on the left?
- Edited
- Best Answerset by CinnaBreadDude
When the player (left sprite) is moved into the right sprite, using the right-arrow key, do you want the player to be teleported back to its original position?
If that's the problem, the reason it's not working is that the "body_entered" signal isn't connected. To fix that, you can connect the signal in the _ready() method in Spike.gd:
func _ready():
player = get_node("/root/Node2D/Boho/KinematicBody2D")
# warning-ignore:return_value_discarded
connect("body_entered", self, "_on_Spike_body_entered")
You can also connect a signal using the Inspector, but it's easier to explain how to do it with code.
DaveTheCoder
It worked, thanks!