Secret wall/unseen entrance

I am making a game on my other account and I have come up with a problem. I want there to be a hole that the player can go down but the hole is not seen until the player is inside it. For example, the invisible secret caves in New Super Mario Bros Wii. They only appear when Mario is inside it.
New Super Mario Bros. Wii Walkthrough: World 1 Level 3 (1-3) + Red & Gold  Mushroom House - YouTube

2 Likes

There is one way that I know of to do this. Make a object that has these properties.

Make the sprite look exactly like the ground from your game. This can be done easily by going to edit sprite, then selecting the “My sprites” icon. This will show all your sprites including your ground. Click your ground texture and your done!

The one thing your invisible ground will NOT be able to do is have that effect your talking about like in NSMBW. It won’t have the circle thing and instead will just show your character walking through the ground. My example also doesn’t allow any other objects to be placed there.

1 Like

You could do something like the circle thing by making an animation play on the block upon collision.

I would do this, but when the player is a certain distance close to this object that will vanish, make it so it eases with the “alpha” behavior. You can see this being done with text fading in and out for things like credits. You can do this for objects as well.

Is there a way to just have the ground disappear when the player is inside it but reappear when there not? I don’t want the circle thing, just the disappearing thing

1 Like

Yes, there is. What you can do is to make these blocks that disappear not solid, but also “enable collisions”. So when the player “collides” with it, there’s no physics effecting it. In the block object, make the collision for the player (or you could use the proximity behavior, which would probably behave better than the collision behavior, actually), and when collided/in proximity with the player, you’ll have to use an alpha behavior. You’ll need to connect a number to this. 0 is invisible, whereas 100 is fully seeable. You’ll want to make it so when the collision/proximity happens, that the alpha goes to zero. And if the collision/proximity is no longer happening, go back to 100.

yes yes, I tried that, but I don’t know how to make it so when the proximity is not happening, it goes away. do I have a negative proximity? have a switch turn off? I just don’t know the code to do it. thanks for the help all of you tho, its very nice of you.

I would make it a switch. It would need to use raycasts instead, but it could work. If the raycast is hit, it turns on the switch, whereas if it’s a miss, it turns it off (have the switch turned off in the editor). I’m not sure which, but either connect a always or once behavior into the input below the on and off selections.

You can use a NOR gate, which triggers every frame if it’s not receiving input. (For the “negative proximity”).

Or you could calculate the distance and filter it. Or you can do what rcreger said.
As always, there are many ways to do the same thing :slight_smile:

1 Like

Could you show me an example?


this is what i’ve got so far but idk if its on the right track.

Hi, I just made an example of a Secret/Invisible Wall Entrance:

Secret Entrance

The logic is inside the “Invisible Dirt” Object. I hope this helps! :smiley:

Also, happy new year! :tada:

3 Likes

I like how the cat’s just like, “oh crap, wait, there’s something here” XD

Great example, once again

thank you so much, its very helpful. that was just what i was looking for.

2 Likes

Hi guys I tried Pixel Pizza’s example, but it didn’t work could u pls help me

Did you select your player object in the proximity behavior block? @DDiallo69

2 Likes

yes i have but my proximity has two things at the front

i got it to work
thankyou guys so much for helping me

Glad you got it working, I just updated the example to have the last version of the proximity (with the inputs).

To anyone else wondering, the solution is to basically add an always and connect it to the “check” input on the Proximity:

1 Like

If your using a distance bundle… would it be better to just put the players x and y globals in the distance bundle, and then use a filter on the output?

I think that would help on performance on using a bunch of proximities.

1 Like