# Set Position vs Move At Angle

### » 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

B
31
S
15
G
10
Posts: 285
Reputation: 7,169

### » 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

### » 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

### » 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
31
S
15
G
10
Posts: 285
Reputation: 7,169

### » 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
363
S
216
G
75
Posts: 23,120
Reputation: 180,534

### » 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

### » 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

### » 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
54
S
7
G
6
Posts: 1,949
Reputation: 7,668

### » 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]

~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

### » 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,198
Reputation: 5,622

Next