Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-17-2010, 04:55 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 7
Default Help required With sprite

i have added two sprite in my cocos2d project. then i want to moved them separately. how i know which sprite the user selected. there is any method
Thanks in advance for your help
shahidpucit is offline   Reply With Quote
Old 03-19-2010, 11:23 AM   #2 (permalink)
Indie Dev
 
hm50's Avatar
 
Join Date: May 2009
Location: South Bend, Indiana
Posts: 162
Post

Quote:
Originally Posted by shahidpucit View Post
i have added two sprite in my cocos2d project. then i want to moved them separately. how i know which sprite the user selected. there is any method
Thanks in advance for your help
If you add the sprites with a tag, you can then refer to the sprites by their respective tag number.

Like This:

Code:
[self addChild: yourSprite z:0 tag:1];
[self addChild: yourSprite z:0 tag:2];

if ([yourSprite tag] == 1){
     yourSprite.position = ccp(x,y);
} else if ([yourSprite tag] == 2) {
     yourSprite.position = ccp(x,y);
}
Hope that helps!
__________________
iPhone 3G

Support Indie Devs!! (that goes for newbs too!)

Apps:
Spell Blocks
See Read Say
iStatus
myVIP
myMVP
hm50 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 256
17 members and 239 guests
2WeeksToGo, @sandris, AdamL, ADY, BrianSlick, Dani77, Dattee, GHuebner, headkaze, mer10, prchn4christ, smithdale87, Thompson22, timle8n1, Touchmint, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,747
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:52 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0