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 sdwrage

Hey all,

I know that ImpactJS has been used to create a LOT of platformers and that's great but this seems to dwarf the kind of information one would need for a Zelda style 3/4 view. Such hurdles I have come across are...

I have a simple 8x8 cube (maybe a box) and my player is of equal size. I would need the player, when standing in front of it to appear to be directly over top of it but with about 2 pixels down (to give the illusion that the player is actually in front of the object). I can do this fine with one of the thin topped collision brushes but then the player, when going around the object, would need to then be directly behind it by changing the sort order and collide with the collision brush at the bottom. This would give the illusion that you could see the top of the players head behind said box. Unfortunately I cant think of a good way to do this.

Next, I was thinking of situations where gravity would be needed. Such as a player is heading left or right and there is a pit... if I dont have gravity on (for obvious perspective reasons) would I just have a trigger over any pit to turn gravity on? Could I only turn gravity on for an entity that enters this? (say I knocked an enemy into it) or would I basically have to set its fall var to true and if true always change the Y value for it to drop?

I am guessing many of you have solutions so thought id ask.

1 decade ago by stillen

I don't use gravity in my top down game concept. In my game I have a magnet that if you are too close, it pulls you closer, similar to the pit concept. I have a trigger entity that if the player sets it sets the plays velocity in the direction of the magnet.

This then moves the entity like its getting pulled. When the flag is set to true, I have the velocity in the opposite direction cut in half, so it seems like its hard to move away from it.

I have a few fences, that I use as enities, not background tiles. That way I can easily adjust the sort order and also have the play do a "jump" animation if you try to walk into the fence after a timeout.

1 decade ago by Joncom

I would need the player, when standing in front of it to appear to be directly over top of it but with about 2 pixels down (to give the illusion that the player is actually in front of the object).
This effect can be achieved using entity.offset. You'd set it only once so that the player always appears a couple pixels below where the hitbox truly is.

[The player] would need to then be directly behind [the box] by changing the sort order and collide with the collision brush at the bottom.
One way to do this is to set game.autoSort to true and game.sortBy to ig.Game.SORT.POS_Y. This means entities further "down" will be drawn above the entities that are further "up".

Could I only turn gravity on for an entity that enters this?
You could enable gravity and then for all entities set entity.gravityFactor to 0 and then change it to some other number when you want them to fall.
Page 1 of 1
« first « previous next › last »