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 Hareesun

I'm trying to have an entity always go 'forward' relative to its currentAnim.angle.

Sort of like how in a top-down racing game (micromachines, for example) the car goes forward in the direction it's facing.

Can anyone lend a hand or share some tips? Thanks :)

1 decade ago by dominic

From the mover.js Entity from the Biolab Entity Pack:

var angle = this.angleTo( target );
this.vel.x = Math.cos(angle) * this.speed;
this.vel.y = Math.sin(angle) * this.speed;

Be aware that angle is in radians, not degrees.

1 decade ago by Hareesun

Thanks for the help you two. Not quite what I was after but I slept on it and figured it out. :)
Page 1 of 1
« first « previous next › last »