I’m making a platformer game that functions similarly to a sidescrolling mario game. In the game I have these brick objects that I want to have break when I jump into the bottom of them or dive into the top. I tried using collisions, but that would make the player lose their momentum, or cancel their jump/dive. I also tried using point collision, but that would only work if I was in the center of the object, and even then If I went to fast I would still collide with the block and cancel my dive.
If anyone has a good idea on how to make this work, please let me know. Thank you all!
This would be my first port of call, but you shouldn’t have at be at the centre of the object to detect it. Did you define a point below the player’s hitbox? Can you screen shot the defined point and the code you used to determine the object-breaking events?
Sorry I phrased this part wrong. What I meant was that the point was in the center of the player, just below the hitbox, so if the center doesn’t line up with the object, it doesn’t break.
I didn’t explain that too well so I’ll attach some images
Second, in your video example it looks like the character’s center isn’t over the block. So, it makes sense to me that it wouldn’t break.
I haven’t tried to implement anything like this in my projects, but I assume if you made two more points to the sides of your first point below the character and moved them out just a little it would address most of your issues.
That being said, I kind of like what you have going on there and it seems to fit in the normal game world logic that I would have to hit near the center of the object I want to break. So for me personally I wouldn’t mind being able to smash down and not destroy the platform below if I position myself properly. I can avoid a hit and keep the platform.
I hope you’re able to get it working like you want though, keep it up ya legend!
That was my first thought too, but just to split the one point into two that are not quite the character width apart.
The problem with that is what happens if you land on the middle of two bricks? Do they both get destroyed? Or do you find the one nearest the character?