Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by ryananger

I'd like to be able to have the player collide on the x axis with a tile, and if the tile has no other collision tiles above it, I want the player to move up to the top of that tile. This way I can make a staircase.

I've looked into using slopes, but I really don't like how they behave. I don't want the player to be able to stand "inside" the tile.

1 decade ago by Joncom

Sounds like you may be doing some custom collision trace work. Basically what you're going to want to do is:

1. When the entity collides horizontally with the collision map, check the tile collided with to see if there's enough space above it to stand.

2. If there is, then instead of stopping the player, maintain speed and shift his position up 1 tile.

3. If there is not enough space, then let the usual collision "entity stopping" occur.

You will probably no longer call this.parent() in your player update function, but you're going to have to handle much of that logic yourself now in order to hi-jack the collision logic.

Take a look at update in entity.js to see what's going on there...

1 decade ago by vincentpiel

Wouldn't it be easier to have a 1-up-lift tile that wouldn't collide horizontally, but when you're inside such a tile you go up one tile, so you get on top of it ? You'll have to handle this behaviour within the update (not to have the player standing inside a stair).
Page 1 of 1
« first « previous next › last »