Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

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

Reply
 
LinkBack Thread Tools Display Modes
Old 02-09-2010, 12:42 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 1
Default Pushing around a uiimageview with a uiimageview

In my app I have a uiimageview of a guy. i also have a uiimageview of ball. I want to make it so if the guy runs into the ball he "pushes" it. How can this be done?
my code for moving the guy is as follows:
Code:
-(IBAction)downRight {
	[self moveRight];
	guyImageView.image = [UIImage imageNamed:@"guy_right.png"]; //right facing image
	timerRight = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(moveRight) userInfo:nil repeats:YES];	
}

-(IBAction)downLeft {
	[self moveLeft];

guyImageView.image = [UIImage imageNamed:@"guy_left.png"]; //left facing image
	timerLeft = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(moveLeft) userInfo:nil repeats:YES];	
}
-(IBAction)downDown {
	
	
		guyImageView.image = [UIImage imageNamed:@"guy_down.png"]; //left facing image

	
	[self moveDown];

	timerDown = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(moveDown) userInfo:nil repeats:YES];	
}
-(IBAction)downUp {
		guyImageView.image = [UIImage imageNamed:@"guy_up.png"]; //left facing image
	
		[self moveUp];

	timerUp = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(moveUp) userInfo:nil repeats:YES];	
}

-(IBAction)upRight {
	if (timerRight != nil) 
	{
		[timerRight invalidate];
		timerRight = nil;
		[self stationaryGuy];

	}	
	
}
-(IBAction)upDown {
	
	if (timerDown != nil) 
	{
		[timerDown invalidate];
		timerDown = nil;
		[self stationaryGuy];

	}	
	
}
-(IBAction)upUp {
	
	if (timerUp != nil) 
	{
		[timerUp invalidate];
		timerUp = nil;
		[self stationaryGuy];

	}	
	
}

-(IBAction)upLeft {
	
	if (timerLeft != nil) {
		[timerLeft invalidate];
		timerLeft = nil;
		[self stationaryGuy];

    }
	
}

-(void)moveRight {

	guyImageView.frame = CGRectMake(guyImageView.frame.origin.x+HorizontalSquareSize, guyImageView.frame.origin.y, guyImageView.frame.size.width, guyImageView.frame.size.height);	
	[self checkForBoundry];

}
-(void)moveLeft {

	guyImageView.frame = CGRectMake(guyImageView.frame.origin.x-HorizontalSquareSize, guyImageView.frame.origin.y, guyImageView.frame.size.width, guyImageView.frame.size.height);	
	[self checkForBoundry];

}
-(void)moveUp {

	guyImageView.frame = CGRectMake(guyImageView.frame.origin.x, guyImageView.frame.origin.y-VerticalSquareSize, guyImageView.frame.size.width, guyImageView.frame.size.height);	
	[self checkForBoundry];

	
}
-(void)moveDown {

		guyImageView.frame = CGRectMake(guyImageView.frame.origin.x, guyImageView.frame.origin.y+VerticalSquareSize, guyImageView.frame.size.width, guyImageView.frame.size.height);	
	[self checkForBoundry];
}
P.S. if your looking for Touch and Hold in buttons, its in my code!


Thanks to anyone who can assist me.
SaturdayNightLive is offline   Reply With Quote
Old 02-09-2010, 12:47 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 10
Default

Im interested in this too. did you figure it out?
TheAppByte 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


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,293
Threads: 39,081
Posts: 171,364
Top Poster: smasher (2,575)
Welcome to our newest member, michael@2label
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0