0 votes

I have set up a hallway with a background that moves vertically in relation with the player's movements, and it is working fine. The hallway background is taller than the hallway so it does not leave gaps in the background when moving. But I want it to not render outside the hallway, as this would cover the space background visible on the outside. The problem is that I have no idea if this is possible, and if it is, how it is done. An area in which the background is allowed to render isn't possible as the hallway's height may vary.

in Engine by (24 points)

1 Answer

+1 vote
Best answer

If I understand you correctly, you might to clip some image to another.

You should try using Polygon2D for your background. It accepts a texture, and it has offsets you can manipulate to move that texture around.

You can then draw the polygon around the other area, and the texture will be confined within that.

by (5,190 points)
selected by

This worked, after I decided to drop height variances from the hallway because they wouldn't fit on some mobile device's screens. Thanks!

You're welcome, glad it was what you were looking for.

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.