Hi there all
This is my first post and don’t care about my spelling, English is not my native
language :).
So I’m creating just a little tank game, everything is fine, tank is moving and cannon turning.
The problem is
public void setDirection(float x, float y) { // parametres are mouse x,y
float rx = x - this.getX();
float ry = y - this.getY();
this.angle = (float)Math.atan2(ry, rx); // cannon angle
}
This rotates the cannon okay, but, I would like to have some kind of delay to that turning (I mean, now
it’s instant.
How is such a thing even possible? Somehow with delta time? I suck at math and physics sooo.
Well, if someone could help, I would really appreciate that!
Thanks in advance
edit. I try to explain better…
The cannon is now facing direction x,y
When I move the mouse, the facing direction changes of course to nx,ny.
I want it to be so that cannon slowly rotates to the new facing direction…