Greetings,
In some games, there are these “weak” or “falling” platforms that basically break a second after the player steps on them (Something like those doughnut lifts from Mario games).
In my game, I made a weak platform similar to what I said above. When the player stands on top of the platform, it will break after a second (It’s currently unfinished right now. No special effects yet)
The weak platform is jumpthru, so when the player jumps on top of the platform from underneath, sometimes the platform doesn’t enter it’s breaking state. However, jumping in the air and landing back on the platform fixes it. I would like to make it so that if the player stands on top AT ALL, it breaks.
Additionally, if the player stands on top of a weak platform with another weak platform just one grid space above itself, then both weak platforms break. The only one that should break is the one the player is standing on, not the one the player is currently standing in front of.
why are you use “for each” event where isn’t needed, and why aren’t you use a “for each” event where it’s needed?
and why are you reset the timers of the unused instances always? why has the unused instances timers at all??
Please be more specific. You said that I used “for each” where it isn’t needed and didn’t use it where it should’ve been, but it isn’t enough information to know specifically which events you’re talking about.
Also, the timer is not ALWAYS reset. It only ALWAYS resets when the variable is 0. When the player steps on top, the variable changes to 1, which stops the timer from resetting. The reason the timer is necessary is because without it, the platforms sometimes disappear instantly when stepping on one of them from another.
i think, but not sure. the only event thats need to be a “for each” is where you checking the value of the timers and delete the platforms. this should prevent undesired deletion of platforms. and because of this, the always resetting event becomes redundant.
and unnecessary to check the collision between the player hitbox and all instances of the platform, because normally it can only stand on one platform at a time. feel free to swap out the collision check to a normal event.
Hi,
Not saying it will fix anything, but I would remove the first for each/reset timer block, and I would nest the last two blocks under a for each.
If you want, you can probably nest all the events under a single empty for each.
It’s possible that these are bugs, I remember seeing some issue about multiple instances sharing the same behavior. If you can reproduce the bugs in the platformer example, share the project and we’ll check it.
Okay, I recreated the example in a different project: https://easyupload.io/eiaw1u
I was not able to recreate the other problem I was having, so here is a GIF of my problem (Notice how sometimes the platforms don’t break when I land on top) (I also apologize for the size and quality. The original GIF was too big to comment, and resizing it without an online resizer turned it into a still image, so this is the best I can provide)
Are there solutions to these problems?
Please try to upload you gif too https://giphy.com/ then copy and share the link, or just try Optimize animated GIF, because with the actual gif we can’t see the issue
I don’t know if is this what you want to achieve, but in this project when the player collides with the platforms and is on the floor, nothing will happend https://easyupload.io/7x56w0
(So sorry for the late reply, I was recovering from wisdom teeth removal)
I downloaded the project and checked what you (And Gruk) did, but sadly, it didn’t help. Sure, it works if the player is on the ground, but if he’s standing in front of a breakblock while on top of another one, they both break.
Is there some sort of event I can use to check the player’s position for EACH block, so that each breakblock can check if the player is standing on top?
Also, here is the requested GIF. In my ACTUAL game, if the player jumps through the breakable platform just BARELY high enough to step on top, they don’t break. Otherwise, they work exactly the same as I’ve showed before. Is there a way to make them ALWAYS break? The code used in the actual project is the exact same used in the test project we’re sharing.
At a quick glance, I think you need to ensure that only breakblocks that the player is directly on top of get “targeted”. This will likely involve checking the Y position of the player vs the block.
I made some quick changes and this seems to do the behavior you want, or at least get you closer:
Thank you mate, this was exactly what I was looking for! A way to check the Y position of the player for each block! I just didn’t know how to execute it. My code looks a lot cleaner too! ^^
Unfortunately, the problem from the GIF above is still in effect, and I’m not sure how to fix it even with the improved code. Is there anything else I can add to make sure the blocks are GUARANTEED to break when the player steps on top? Thanks
You’re not having troubles at all?
I’ve tested this in the shared project, and it always breaks too. I’m not sure why I get the error in my actual project.
Perhaps there’s something wrong with my player’s hitbox…