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
34
S
16
G
10
Posts: 285
Reputation: 7,349

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,180

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
34
S
16
G
10
Posts: 285
Reputation: 7,349

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
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

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
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

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
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

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
47
S
10
G
9
Posts: 1,224
Reputation: 8,424

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests