whatever i try it returns null or error…
cant get the player to detect the right collision he sits on. Not even detect if onWayCollision in ON ?
is there a way to detect the collisions ? Even if i added multiple StaticBodies2D each one with their own collisionShapes the result would be the same , cant get to that oneWayCollision bollean
Will return the first child of the platform. If it is a collision shape, that’s what you need.
You may need to look it up by other means that by index. Like a name, for example.
Even better if the platform script itself provides a reference to its collision shape.
your player node looks like a characterBody2D
and the signal of body_entered is from that area2d receiving any collision shape entered it, this body_entered signal from area2d with your lots of collision shape2d should connect to area2d script that’s not the player. example the area2d walls has a script that receive its own body_entered signal.
in theory, the player when stepped inside this area2d will trigger the body_entered signal of the walls
Your walls are of type StaticBody2D, i.e. immovable objects. I believe just like with RigidBody, the “on_entered” event is never fired between static/rigid body and characterbody b/c they’re all “solid” objects and thus can’t enter each other. They only push on each other. So yes, they collide, but they don’t overlap, hence no entering/exiting.
As long as your wall’s Collision Mask is set to same number as your player’s Collision Layer property, the player will automatically stop when they get to the wall. I.e. the collision will happen.
If you want to check for collision programmatically, inspect the object returned by move_and_collide() method
I just dont like the " body.shape_find_owner(body_shape_index) " it feels like he’s looping… the owner should be the body in just 1 on area enter… but it only works this way