Closed razcore-rad closed 5 years ago
Areas have trouble detecting manually created collision polygon in some cases, they're a lot more reliable with CollisionShape2D in my experience. Dunno if this is related
We're using CollisionShape2D
and the shape resource we defined is a SegmentShape2D
. This might be the issue, I'll try different shapes and see how it behaves.
I just tested it and it still happens I guess. There are some times that the stomp is triggered, but the enemy doesn't die. This is particularly reproducible in Level 2. I think it has to do with the Enemy's StompArea2D's
SegmentShape2D
not covering the Enemy's top part entirely.
Increasing its size, covering all the top portion, causes lateral collisions to also trigger Player.stomp()
and killing the enemy instead of the player.
Is it worth to reopen this issue @NathanLovato ? I think that separating the Player's enemy detector into 2 areas with dedicated collision layers can fix it.
I made a fix on my fork, check the implementation you can fetch it and merge it here in the original repo.
You can see the the player can stomp from some distance, this is tweakable the important thing is that now it won't detect lateral collisions while still detecting the stompable area of the enemy, which can be just a small portion of its head, as well as the player's stomping area
Thanks, you can commit a fix like this straight, no need to write a report or to record gifs if you're already fixing it
Just cherry picked your commit, it's done. Moving forward could you work straight on branches on the main repo? there's no need to fork as you're part of the team
For some reason
_on_Area2D_area_entered()
gets (correctly) triggered when the Player stomps on the Enemy while_on_StompArea2D_body_entered()
doesn't get triggered at all. This seems like a Godot bug, but we'll need to find a workaround anyway. Might have to do with the fact that we're usingSegmentShape
as the collision shape resource. Will have to investigate.This can be reproduced easily in my fork: https://github.com/razcore-art/Your-First-Game-Godot-2d-Platformer/tree/feature-artwork, the "artwork" branch by having the player always move to right & jump on the platform falling on the enemy. We can see that the player correctly jumps up but the enemy doesn't die.