# How to move an object to an exact position?

### » Fri Dec 31, 2010 6:08 am

Hello, how would I move a sprite to a set position, say (230, 350) for example, at a set speed?
B
13
S
7
G
6
Posts: 84
Reputation: 4,008

### » Fri Dec 31, 2010 6:22 am

There's a number of ways to go about this. The easiest way would probably be to give the object RTS behavior and then "Add Waypoint at Position".
B
2
S
1
G
3
Posts: 19
Reputation: 1,038

### » Fri Dec 31, 2010 8:21 am

You could use the bullet behavior and set its angle towards the goal position.

I still believe there are better and efficient ways. That's just the way I did it. I still have a lot to learn about construct myself.
B
3
S
1
G
2
Posts: 86
Reputation: 997

### » Fri Dec 31, 2010 11:33 am

[quote="JackieChann":155izyld]Hello, how would I move a sprite to a set position, say (230, 350) for example, at a set speed?[/quote:155izyld]

The easiest way to achieve this would be the "Move at angle" action of the sprite object. You can set the speed (pixel distance) and the angle to travel by. Use the angle expression like this:

angle(sprite.x,sprite.y,230,350)

and don't forget timedelta for your speed.
B
27
S
6
G
11
Posts: 1,051
Reputation: 8,173

### » Fri Dec 31, 2010 7:44 pm

thanks guys! But I found a solution by using the path movement. I made an example for anyone who wants to see how I did it.

http://dl.dropbox.com/u/13338856/move%2 ... sition.cap
B
13
S
7
G
6
Posts: 84
Reputation: 4,008

### » Sat Jan 01, 2011 3:25 am

Path movement is overkill for something simple like that. PR's solution is the most efficient.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971