Some background before I get into it. I'm building a game where the player can flick an object around the screen crashing into other objects.
All the object is doing right now is moving in straight lines and it goes by pushing the mouse button down then moving to another point and letting it go then it takes on the speed of that and the angle.
The problem is that it only moves in straight lines, I want to give the player the ability to curve the object. Then the object would conform to that curve depending on the velocity so say that you're running fast you wouldn't be able to make a sharp turn quickly. (I've pasted a bit of the code below on how it moves and I've attached the whole program, it's in CS3)
The only equation I know that will get me a 3rd point is:Code:target_angle = Math.atan2(distance_y,distance_x); player_velocityX = Math.cos(target_angle)*rate; player_velocityY = Math.sin(target_angle)*rate;
But that will only give me a uniform curve every time, I need it to be specific to the movement.Code:getting curve distance = ((x1*x1) + (x2*x2))/2 //Repeat for y
Are there any formulas I can apply that will allow the object to mimic the gesture of the user?
Thanks




Reply With Quote
