Skip to content

Commit

Permalink
Broken rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuj committed Mar 9, 2022
1 parent 268fa9d commit a43ef8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Characters/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,18 @@ public override void Update(GameTime delta)
var mouseState = Mouse.GetState();
Vector2 mousePos = Scene.ToGridLocation(mouseState.Position);
Vector2 deltaPos = new Vector2((mousePos.X - Position.X), -(mousePos.Y - Position.Y));

//DiagnosticsHook.DebugMessage(deltaPos.ToString());
float angleA = (float)Math.Atan(deltaPos.X/deltaPos.Y);

double personAngle = Math.Atan2(deltaPos.Y, deltaPos.X);
//double personAngle = Math.Atan2(deltaPos.Y, deltaPos.X);
//double personAngle = Math.Atan(tanAngle);
//DiagnosticsHook.DebugMessage("Tan angle = " + tanAngle);
//DiagnosticsHook.DebugMessage("Person angle = " + personAngle);
float radianAngle = (float)((Math.PI / 180) * personAngle);
//DiagnosticsHook.DebugMessage("Radian angle = " + radianAngle);
//sprite.Rotation = radianAngle;
//float radianAngle = (float)((Math.PI / 180) * personAngle);
DiagnosticsHook.DebugMessage("angle = " + angleA);
sprite.Rotation = (float)3.14;


if (health <= 0)
{
Expand Down

0 comments on commit a43ef8a

Please sign in to comment.