I use this source for my player: http://ix.io/1J5x the thing is the obstacles are moving. The thing is handle_death_collision is ONLY called when pressing a direction. If I press nothing the pusher works but the event is not called. But it should. Why is it not called?
I’m… not seeing any collision-nodes with the name “obstacle”, so I’m a little mystified that the method is called at all, with a key pressed or not–unless there’s some code that you haven’t shown us.
In fact, I don’t see a call to “enableKeys”, to allow the task to run, or a call to “base.run”, so I’m guessing that there is indeed some code that’s missing here.
Could we see the remaining code, please? There might be a clue there.
First: thank you for your time and thank you for asking back.
The main.py: http://ix.io/1J7Z
buildtrack.py if needed: http://ix.io/1J81
The obstacle-names are in the eggfiles of the track, one example eggfile: http://ix.io/1J82
A screenshot for better imagination: http://pasteall.org/pic/show.php?id=bdc7b4172efac1c03f7b337f2815b7a5
Earthlike-parts are tagged with track and the stonelike-parts are tagged with obstacle. I found another problem: when I jump against an obstacle, i fall through the floor with the jumpvelocity going up way too fast. I stopped at around -400. Was less then a few seconds. Under the obstacles is still track and this does not happen when jumping over an obstacle but when jumping against it. So this is the second issue I am having here.
Maybe it would be worth removing elements like your jump-logic and just focussing on getting the collisions to work properly. That way there might be fewer “moving parts” to complicate debugging. Once that’s working, you can re-add the removed elements, but now (hopefully) placing them on a more-stable base.
Otherwise, having looked at your code, but without examining all of that code in more detail, I’m not sure of what’s going wrong, I’m afraid.
One thing that occurs to me is that, if I recall correctly, the collision-system expects the collision-nodes specifically–and not any parent-nodes–to have the name given in a collision-event call to “accept”. Perhaps it would be worth searching your level-geometry, finding the collision-nodes, and seeing what names they have. If they’re not all named “obstacle”, you can perhaps try setting their names to that.
Something like this:
# Find all nodes of type "CollisionNode"
colliders = myLevelGeometryModel.findAllMatches("**/+CollisionNode")
for nodePath in colliders:
# If called for:
You could call
base.bufferViewer.toggleEnable() to see if the event is getting fired at all. Similarly, you can add
notify-level-collide debug to Config.prc to see if the collision is being registered at all.
If you can’t figure it out, please zip up your game so that I can run it for myself.