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 Nathre

I made a map like the old rpg games (like Zelda) but i have a problem when an entity is under (y axis) another. The size of the toonA&B's images are 4x10 and their collision boxes are 3x2 (like a rectangle) with offsets so their heads can go over the walls but not their feet. The problem comes when toonB, which is on a position higher on Y axis, goes ahead toonA which should be over toonB.


Any of you guys know the solution to this problem?

Regarts, Nathre

1 decade ago by motoko

http://impactjs.com/documentation/class-reference/entity

Look for the zIndex property, you should be able to re-assign zIndex based on each entity position or axis(ent.zIndex = ent.pos.y+?), so that higher (or lower) entities are 'drawn' in the order they should be, and then call the ig.game.sortEntities(); method.

I have never done it, but it seems reasonable to me :).

1 decade ago by Nathre

Ty, very kind of you. Gonna test it and i will tell you if it works out
Page 1 of 1
« first « previous next › last »