0 votes

I have just started making my own version of Flappy Bird. For the logic, I have the bird which is a kinematic body in the center of the screen. I want to pipes to come from the
left of the screen and go out from right. I want to find a way to teleport the pipes from the left of the screen to the right by changing the coordinates of it. How can I do this in gdscript?

in Engine by (22 points)

1 Answer

0 votes
Best answer

Just to make sure, since you said two opposite things. You want the pipe to start at the left, move across the screen, and then teleport from the right back to the left. Correct?

You just need to set the body's position property. For example:

if position.x > screen_size.x:
    position.x = 0

If it was the opposition you wanted, reverse the above.

by (21,311 points)
selected 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 Frequently asked questions and 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.