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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 03-24-2011, 02:17 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 3
saiprashanth is on a distinguished road
Smile UIImage Ball collision on specific direction of another uiimage causes it to deflect

The Problem is very simple and weird for me...

I have created a UIImage of a ball and another UIImage of red gem...

when the ball collides it has to pass through it and increase the speed... The speed is increasing and its working ...........but

if the ball collides from the bottom it gets deflected back and the speed is changed... if the ball collides the image from top the speed gets increased and the ball continues to move without any deflection....

the speed is working and collision is working..but the problem is if the collision takes place on the top of the gem it does not have any problem...but ... if it collides from bottom the speed is getting changed but the ball gets deflected instead of passing through the gem ??
saiprashanth is offline   Reply With Quote
Old 03-24-2011, 02:57 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

probably the problem is on your code. show it.
__________________
dany_dev is offline   Reply With Quote
Old 03-24-2011, 03:32 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 3
saiprashanth is on a distinguished road
Smile

Quote:
Originally Posted by dany_dev View Post
probably the problem is on your code. show it.

Thanks dany for ur time...

i have added the code below


if (CGRectIntersectsRect(ball.frame, red.frame) && red.hidden == NO )
{

if( redpass == false)
{

score1 += 2000;
scorered+=1;

redpass = true;
red.hidden = YES;

kBallSpeedX = 6 ;
kBallSpeedY = 6;


ballVelocity = CGPointMake(kBallSpeedX,kBallSpeedY);



}

}

if (CGRectIntersectsRect(ball.frame, red.frame) && (redpass == true) )
{

score1+= 0;
scorered+=0;
red.hidden = YES;

}

else {

redpass = false;

}



this is the code for collision check and speed increase....
saiprashanth is offline   Reply With Quote
Reply

Bookmarks

Tags
apple, collision, deflection, sdk

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: 363
11 members and 352 guests
condor304, dansparrow, Domele, dreamdash3, ilmman, LezB44, michelle, Sami Gh, shagor012, thephotographer, tinamm64
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

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