15,399,440 members
1.00/5 (1 vote)
See more:
Hello everyone!

I am trying to add angles to my game. However,
when I add these angles, they just don't work:

C#
```if (e.State.X < Cradle.GraphicsManager.PreferredBackBufferWidth / 2)

e.State.X = Mouse X,Y
Cradle.GraphicsManager.PreferredBackBufferWidth = Width, Height of the form. ```

Also, there should also be an else statement, but I wasn't sure how to do this one yet, so I couldn't go to the next one. Any ideas why this doesn't work?

Edit: The problem is when I look down it faces up, and when I look down it doesn't do anything.
Edit:Edit: I'm trying to make a head turn, but I flip the Texture when the else statement arrives.
Posted
Updated 6-May-13 23:43pm
v4
CPallini 7-May-13 5:44am

It is not clear (at least to me) what are you trying to accomplish. Could you please state it more clearly?
Deviant Sapphire 7-May-13 5:50am

First of all, please stop unneccsarily editing my post. Next, I am trying to accomplish getting the angles by points. For now, the angle should be calculated from the middle of the form, to a point on the screen. Unfortunatly, whenever I do this I seem to be getting odd results.
Deviant Sapphire 7-May-13 5:54am

"Uneccsarily editing my posts" Well grammar failed quite hard there. Oh, and that was pointed at the guy, not you, sorry. :L
CPallini 7-May-13 6:23am

Oh don't worry.
You need at least three points if want to compute an angle.
Deviant Sapphire 7-May-13 6:26am

No you do not? :L

X

Y

X -> Y = ~135.
CPallini 7-May-13 6:47am

I don't get you, please elaborate.
Matt T Heffron 7-May-13 13:31pm

Yes, you do need 3 points!
In this case you are just assuming one of them, the "implied" point directly "up" from your X.
Keith Barrow 14-Jun-13 8:22am

I wish I could upvote this.
Deviant Sapphire 7-May-13 6:42am

I got it fixed.
Deviant Sapphire 7-May-13 6:35am

Okay, so I fixed the first line. It was because I forgot to do the Y.
But still the head is turning the wrong way?

## Solution 1

Solution:

```Vector2 dPos = new Vector2(e.State.X - Cradle.GraphicsManager.PreferredBackBufferWidth / 2, e.State.Y - Cradle.GraphicsManager.PreferredBackBufferHeight / 2);