Rotate Layer Jumps Degrees with Keyboard Controls

Get help using Construct 2

» Sat Jan 14, 2012 7:46 pm

This is my first time using Construct 2 and I am having trouble understanding what is going on.

First what is the point in having to set 2 points.
angle(sprite2.X,sprite2.Y, center.X, center.Y)
I understand you need two points to create a circle, center point and distance but it doesn't seem that the position of sprite 2 makes a difference since the whole layer should be rotating.

Next Question is I am having a problem with the angle jumping when swithcing from left to right (or right to left) movement. It jumps several degrees instead of a nice clean 1 degree. If you tap the right/left button it sometime will be 5 to 20?. Not sure what is going on. (There is probably a better way to set the angle instead of a counter)

Problem with Rotation

Version 2 center point.

B
9
S
1
G
3
Posts: 19
Reputation: 1,628

» Sun Jan 15, 2012 3:48 pm

Nevermind I got it to work thanks to Weishaupt post
Center to Viewport
B
9
S
1
G
3
Posts: 19
Reputation: 1,628

» Sun Jan 15, 2012 3:54 pm

I will answer your first question. angle(X1, X2, Y1, Y2).   With this option you need a line to set an angle (because that angle compares with an imaginary line on the x axis.) So, X1,Y1 to X2,Y2 draws this line in memory so the computer can calculate the direction/angle compared to the x axis...

This works great to position a sprite facing toward another sprite or the mouse every tick of the program.   Does that make sense?

At least that is how I make sense of it...Zetar2012-01-15 15:56:37
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

» Sun Jan 15, 2012 4:27 pm

Yep I get it now, I just didn't see the relationship of the X1,Y1. Awesome thanks for the answering the question.
B
9
S
1
G
3
Posts: 19
Reputation: 1,628