1
\$\begingroup\$

I'd like to find a way to add holes caused by a 'bomb' to my floor sprite, a bit like what is in this game here.

Basically there is a sprite (the green floor) and another sprite (the bomb) that falls on top of the green floor and the bomb then explodes. Once exploded part of the green floor sprite is gone. The player (red ball) can then move the sprite inside the new cavity that was created in the green floor sprite.

enter image description here

\$\endgroup\$
0

2 Answers 2

0
\$\begingroup\$

I'm not sure if this is the way that that game specifically did it but what you do is create a texture which is then subtracted from other textures. So in this can you create a shape which represents the whole in the ground, then you when the bullet explodes it subtracts the shape from the ground texture and leaves a whole in the ground texture.

When you move around you then check if your in one of these transparent textures so that you know that you can go into that area. If there aren't any special transparent textures more around normally.

Here is a similar question on the unity answers which goes into detail of how to implement this.

image showing what I mean Image taken from above unity link

Keep in mind that is only one possible solution, for all we know they made a texture which they swap out when they need to remove a part of the screen which would have the same effect...

Hope this is what your looking for :)

\$\endgroup\$
0
\$\begingroup\$

You can just draw holes over the floor object, here all the holes have their own class with separate properties from the floor class:

enter image description here

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .