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.
Quote this message in a reply
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

Google vector subtraction.
Quote this message in a reply
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!!
Quote this message in a reply
Moderator
Posts: 1,560
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.
Quote this message in a reply
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.
Quote this message in a reply
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.
Quote this message in a reply
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

Google vector subtraction.
its a nice info man..!!! i wasnot knw about it....
Quote this message in a reply
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...

[Image: Vector_subtraction.png]
Quote this message in a reply
Member
Posts: 65
Joined: 2009.01
Post: #9
compiler - what program did you use to make those arrow images?
Quote this message in a reply
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?

Google. :-)
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  PVRTexture loader give error 0x0500 sefiroths 2 4,476 Mar 25, 2011 03:52 AM
Last Post: sefiroths
  Direction of normal Miglu 3 3,454 Oct 4, 2010 05:08 PM
Last Post: Skorche
  Direction formula? TimMcD 2 4,995 Nov 11, 2009 11:42 PM
Last Post: TimMcD
  Have Hierarchical Sprite Tree, Need To Transform Screen X,Y To Determine Which Sprite kalimba 5 5,788 Mar 16, 2009 06:31 PM
Last Post: AnotherJake