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 02-24-2010, 09:54 PM   #1 (permalink)
Registered Member
 
Whitehk's Avatar
 
Join Date: Feb 2010
Posts: 118
Default Handle multiple touches without interfering with one another?

Hi. You might have seen my previous thread. If not, I am trying to create a multiplayer pong-like game (the 2 player-same device option on the glow hockey app would be a great example of what I'm trying to create only in the form of pong) and I need to figure out how to detect multiple touches without interfering with one another (or you can go to this link: http://www.iphonedevsdk.com/forum/ip...tyle-game.html). I don't want player 1 to have to lift there finger in order for player 2 to be able to move their paddle. I want them to be completely separate touches. This is what I have so far:

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent*)event {
UITouch *touchPlayer1 = [[event allTouches] anyObject];
UITouch *touchPlayer2 = [[event allTouches] anyObject];
CGPoint locationOfPlayer1 = [touchPlayer1 locationInView:touchPlayer1.view];
CGPoint locationOfPlayer2 = [touchPlayer2 locationInView:touchPlayer2.view];
CGPoint xPlayer1Location = CGPointMake(locationOfPlayer1.x,player1.center.y);
CGPoint xPlayer2Location = CGPointMake(locationOfPlayer2.x,player2.center.y);
if(locationOfPlayer1.y > 240) {
player1.center = xPlayer1Location;
}
if(locationOfPlayer2.y < 240) {
player2Multiplayer.center = xPlayer2Location;
}
}
Whitehk is offline   Reply With Quote
Old 02-25-2010, 01:20 AM   #2 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 126
Default

Edit: Nvm, smasher gave a perfectly good technique in the other thread.
javaconvert is offline   Reply With Quote
Old 02-25-2010, 08:40 AM   #3 (permalink)
Registered Member
 
Whitehk's Avatar
 
Join Date: Feb 2010
Posts: 118
Default

nvm
Whitehk is offline   Reply With Quote
Reply

Bookmarks

Tags
multiplayer, multitouch, no interference, touch, touch location

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: 274
22 members and 252 guests
ADY, Bertrand21, Dani77, fkmtc, HemiMG, iDifferent, IphoneSdk, jakerocheleau, JasonR, jimbo, macquitzon216, MACralik, mer10, NSeven, prchn4christ, Rudy, silverwiz, spiderguy84, Sunny46, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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