0 votes

Hello!

So I embarked on a journey to make my first Godot game, I decided to start simple - with a match-3 game. There is, however, one thing that I am not quite sure how to achieve simply.

I have a grid with gems and when some gems are matched and disappear, the grid gets refilled from the top. However, the grid does not take up the whole window and there is a significant free area around the grid.

Now, I want the refilling gems be visible ONLY inside the grid area and not outside the grid. There is a background picture however, and the grid is partly transparent.

Here is a picture of the game. Now I would like the blue gem at the top to be completely invisible and have the green gem cutoff at the top.

gems

I know of a solution that will work but I really would like to avoid it. That would be to create a sprite above the grid, that's duplicate of the background and simply give it higher Z-index than the gems.

I suspect there must be simpler and nicer solution than this, do you have any ideas?

Thanks in advance!

in Engine by (62 points)

1 Answer

+2 votes

You could enable clip content in the parent container

by (398 points)
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.