give direction to sprite

Nibbie
Posts: 3
Joined: 2011.03
Post: #1
Hi! I have a sprite which i move by touching it...i drag it all around the screen an d when i leave it I want it to move to the direction wheew my hand was moving...I mean...drag and move,leave it,continue moving to the direction pointed by me.
Apprentice
Posts: 8
Joined: 2011.03
Post: #2
You want to find the velocity vector of the sprite and you know two vectors:

- position of sprite
- position of target

Nibbie
Posts: 3
Joined: 2011.03
Post: #3
Thanks but what should i use?BOX2d?Im new and I have no idea..any help please!!
Moderator
Posts: 1,563
Joined: 2003.10
Post: #4
The problem as stated wouldn't require a physics engine like Box2D, just some simple interpolation/velocity code. We'll be able to help you more if you post some detailed information about what you're trying to do and what's giving you trouble; there isn't a whole lot to go on from what you've posted so far.
Nibbie
Posts: 3
Joined: 2011.03
Post: #5
Im sorry but i I cant post code..what i want is when touch ended method gets called,the code will have "saved" the direction to which my hand was pointing before i release the sprite and then to automatucally continue moving the onject to that direction.
Apprentice
Posts: 8
Joined: 2011.03
Post: #6
Are you new to programming? Games? iPhone programming? You're going to have to write code in a computer language to accomplish what you want. Programming isn't something you can just decide to pick up one day and start cranking out games.
Nibbie
Posts: 1
Joined: 2011.02
Post: #7
(Mar 10, 2011 11:26 AM)compiler Wrote:  You want to find the velocity vector of the sprite and you know two vectors:

- position of sprite
- position of target

its a nice info man..!!! i wasnot knw about it....
Apprentice
Posts: 8
Joined: 2011.03
Post: #8
So if a is the position of the target, and b is the position of the sprite...

Member
Posts: 65
Joined: 2009.01
Post: #9
compiler - what program did you use to make those arrow images?
Apprentice
Posts: 8
Joined: 2011.03
Post: #10
(Mar 11, 2011 02:17 PM)johncmurphy Wrote:  compiler - what program did you use to make those arrow images?