Set Position vs Move At Angle

For questions about using Classic.

Post » Fri May 22, 2009 9:30 pm

I need to make repositioning stuff per tick. I have used move at angle because it gives me angle option but I am not sure if it is the right way to do this. I need "teleport" style positioning, so I think it is not TimeDelta dependant.
Example:

x = x + 50

or...

move 50 pixel at angle 0

Any advice?
B
30
S
15
G
10
Posts: 285
Reputation: 7,144

Post » Fri May 22, 2009 11:36 pm

How exactly are you teleporting? What's the situation? What is the game mechanic/control style?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat May 23, 2009 7:48 am

x = x + 50 would work, just make sure it is not a continuous event, otherwise it will zoom out of screen within a few frames. Trigger once, key pressed etc. are proper triggers. Move at angle is fine, too. It is basically like this:
x = x + cos(angle)*distance
y = y + sin(angle)*distance
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat May 23, 2009 3:24 pm

Thanks for the clarification Mipey. Basically I wanted to know if there was any differences between them.
B
30
S
15
G
10
Posts: 285
Reputation: 7,144

Post » Sat May 23, 2009 3:40 pm

It's just a handy helper function to do the math Mipey posted for you, so in the case of moving 50 pixels right or moving 50 pixels at angle 0, they're identical.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sat May 23, 2009 10:15 pm

*insert sneaky petition to get rotate around point action*
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun May 24, 2009 9:12 am

Actions which continually do something or perpetuate are generally not as handy as they first seem. Rotating round a point/object can be done very easily as it is.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sun May 24, 2009 4:18 pm

[quote:2nuxkwl2]*insert sneaky petition to get rotate around point[/quote:2nuxkwl2]

im doing this without variables to store the relative angle and distance cause i don't feel like it.
point.x+cos(angle(point.x,point.y,object.x,object.y)+(amount you want changed))*(distance(point.x,point.y,object.x,object.y))
point.y+sin(angle(point.x,point.y,object.x,object.y)+(amount you want changed))*(distance(point.x,point.y,object.x,object.y))
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun May 24, 2009 5:02 pm

[quote="QuaziGNRLnose":25rc33bn][quote:25rc33bn]*insert sneaky petition to get rotate around point[/quote:25rc33bn]

im doing this without variables to store the relative angle and distance cause i don't feel like it.
point.x+cos(angle(point.x,point.y,object.x,object.y)+(amount you want changed))*(distance(point.x,point.y,object.x,object.y))
point.y+sin(angle(point.x,point.y,object.x,object.y)+(amount you want changed))*(distance(point.x,point.y,object.x,object.y))[/quote:25rc33bn]

After all these years, my head STILL hurts when I read your posts... O.o

~Sol

P.S. I still love you.
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon May 25, 2009 1:30 am

Oh comon Sol, it's just sin and cos, they're a game designers two best friends. Get more acquainted with them!
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests