+2 votes

I have a scene UI.tscn, which uses a canvas layer as a main node where I was able to code a crude life bar.
Now I would like to make a minimap. I thought about using a container and a viewport container in order to only show part of a sprite (which would become my map, then I could move the sprite with the player character in order to "Update" the minimap)
I started by using this setup: https://imgur.com/LxN7GI6.
Where the control node has a child container, then a viewport container and finally a sprite as a child.
However, when I test it with the sprite outside of any of the containers ( https://imgur.com/97FisDO ) it still shows completely in the game ( https://imgur.com/r50RAKV ).
Can anyone help? Is it a completely false way a tackling the problem and I should use something else?

PS: I tried reading the other minimap questions, but they were speaking about using another camera i think? Being new to godot I did not understand much about the answers. Sorry about that.

EDIT: I found the answer and I would like to delete the question. It's not approved yet so I you read this don't approve it i guess?
For anyone wondering you need to use the scroll container node sorry for wasting your time.

in Engine by (17 points)

1 Answer

+1 vote
Best answer

You don't need to use a scroll container for that, any container will work, and then set the "Clip Content" flag to on. This can be found in the Control/Rect section of the inspector.

by (319 points)
selected by

oh wow I didn't see that option. Thanks for the heads up!

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.