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

View Single Post
Old 04-02-2009, 10:44 AM   #41 (permalink)
LeopardDevX
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Arrow yes..

Quote:
Originally Posted by .mb View Post
Code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
	UITouch *touch = [[event allTouches] anyObject];
	CGPoint location = [touch locationInView:touch.view];
	for(newBall in enemies)
	{
		newBall.center = CGPointMake(location.x,location.y);
	}
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
	UITouch *touch = [[event allTouches] anyObject];
	CGPoint location = [touch locationInView:touch.view];
	for(newBall in enemies)
	{
		newBall.center = CGPointMake(location.x,location.y);
	}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
	UITouch *touch = [[event allTouches] anyObject];
	CGPoint location = [touch locationInView:touch.view];
	for(newBall in enemies)
	{
		newBall.center = CGPointMake(location.x,location.y);
	}
}
That's what I have now. It works, and it moves them to the touchpoint when released, but it moves all of them.

When your doing for(newBall in enemies)
all the newBalls on the screen moves.. i guess you spawn some enemies... and you spawn those with the name "newBall" then all they will move!!!
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
 

» Advertisements
» Online Users: 295
21 members and 274 guests
ADY, AppAnnex, chemistry, fkmtc, HemiMG, her-ur, iDifferent, ilmman, leahov, MarkC, marto1914, nicko, padsoftware, Raffaello, sneaky, sojourner, syver, tathaastu, timle8n1, touchcream, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,219
Posts: 380,712
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:36 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.