Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Barji

Pages: [1]
1
General / Moving towards direction of rotation.
« on: November 01, 2020, 05:59:08 pm »
There have been questions posted on this in the past but some are contradictory and I'm having trouble abstracting. I've successfully got my player moving in the direction of the player however It follows a sin/cos path when moving. I'm relatively new and was wondering if i could be pointed in the right direction.
I imagine it has something to do with my DeltaTime or velocity as their values are changing.

void Movement()
{
        direction.x = sin(DegToRad(playerSprite.getRotation()));
        direction.y = -cos(DegToRad(playerSprite.getRotation()));

        playerSprite.move(direction.x * velocity.x * Delta_Time() * movementSpeed, direction.y * velocity.y * Delta_Time() * movementSpeed);
}
 

Pages: [1]