Making an enemy jump up a platform
ookami007
Member Posts: 581
I have created behaviors that allow the enemy to "turn on" when the player is nearby and then follow him. This often leads to the enemy falling down onto a lower platform while the player can jump up and get away.
Is there a way to tell that the collision happens on the right or left rather than top or bottom so I know whether the enemy needs to jump back up onto the higher platform?
Comments
While the question is kind of confusing, ill take a shot at answering it.
To detect collisions to the left or right you can often simply say on the platform or collision object:
when actor overlaps or collides with object and actor.x is < self.position.x collision is left
when actor overlaps or collides with object and actor.x is > self.position.x collision is right
Of course you can also use offsets on the x positions for a more precise collision space. This isn't the only way, but its a nice simple solution for most cases.
I'm confused on how you would relay this information to the actor. How would you keep track of which enemy was making contact vs which platform.
I did find an alternate way to do it.
I setup triggers - like my spawn triggers - that tell the enemy to interpolate to the new location. It looks "pretty good"... not completely natural, but given the situation, I doubt I can get it to look too much better.
Triggers and invisible walls if the actor collides with it, sends up or sends it in a different direction
Like Balls? Then click here! We've 100 coming soon