phoboslab/high_impact

Old school ladders

Opened this issue · 1 comments

Hi,

Any plans to add support for old school ladders? I mean like these ones

image

I've tried to add support modifing the collision map but it's just buggy and not that fluid.

I'm in love with your work! Thanks for sharing it

How exactly these would behave is very game specific; I don't think it makes sense to support this type of "collision" directly in the engine.

Without thinking about it too much, here's how I would do it:

  1. Create an invisible, resizable entity ladder and position it to cover the graphics.
  2. Set your player to check against this entity. E.g. player->check_against = ENTITY_GROUP_ITEM, ladder->group = ENTITY_GROUP_ITEM.
  3. In your player->touches() check for other->type == ENTITY_TYPE_LADDER and set a flag self->player.on_ladder = true
  4. In your player->update() check for this flag and change the behavior accordingly. E.g. self->gravity = 0, set self->vel.y on up/down arrow.