#Standing on top of a CharacterBody2D npc but when it moves, it doesn't carry the player with it.
10 messages · Page 1 of 1 (latest)
This is the player standing on top of the enemy. but doesnt move with the enemy when the enemy walks
You'll probably want to make the player a child of the enemy when it's on top of it
Then undo it when it jumps off
Or another way is update the player position by the same amount the position of the enemy is moving
Few different ways to do that, depending how you want it yo work
character bodies have built in platform following behavior, it's enabled by having their motion mode set to grounded and by enabling the platform's collision layers in the character's "floor layers" property
but note it only runs if you use move_and_slide() in the character
also there's a bug with animatable bodies where their collisions don't actually move when their parent node moves, animatable bodies only move correctly when the itself is moved, but I think you would notice that bug if you saw the enemy sprite move, but the player hovered in place as if the enemy didn't move at all (this bug is weird, visible collision shapes will still move on the screen, the bug only happens internally in the physics engine collision detection)
ohhh thats new tro me!