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 Hazneliel

Is there a way to have Gravity affect elements in diferent directions, for example this game colour-bind where blue objects fall upwards and red objects fall to the bottom while green objects fall to the right...

Is there a way in Impact to change gravity direction?

Thank you

1 decade ago by alexandre

If all you want is multi-direction axis-aligned gravity, best is to, in your ig.Entity subclass, overwrite the update method and not invoke its parent's, paying attention to & customizing this line:
this.vel.y += ig.game.gravity * ig.system.tick * this.gravityFactor;

and adding same for vel.x.


If OTOH you want non-axis-aligned gravity, you may want to check out this localGravity plugin I wrote a while back.

1 decade ago by Hazneliel

Thank you very much =)

1 decade ago by boomshanka

Hi Hazneliel did you find a way to implement this? I need a similar way to simulate gravity from multiple directions but I haven't been able to figure it out.

@alexandre: maybe you can provide me with a simple example?

1 decade ago by alexandre

@boomshanka sorry I've been away these past few days.

More info on the local-gravity plugin here .

Let me know if any of the instructions are unclear.

Cheers.
Page 1 of 1
« first « previous next › last »