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 Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-09-2011, 11:24 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 2
emerson1234567890 is on a distinguished road
Default Corona SDK collision problem

I am developing my first mobile application with Corona SDK. This is the rule of my game: I have this ball and when it collides with the end of the maze, it will show a dialog box that you passed the level. I tried adding a collision listener at the finish line, but it doesn't work. The code I used DOES show the dialog box, but it happens that the dialog box popups when the ball collides with EVERY border I have (not the finish line).
Here is the code I have so far(part of it):
Code:
    local ball = display.newImage("ball3.png", _W, _H);
    ball:setReferencePoint(display.CenterReferencePoint);
    ball.x = 350; ball.y = 100;

    local borderend = display.newRect( 65, 55, 20, 100 )
    borderend:setFillColor( 0, 0, 0, 0)		-- make invisible
    physics.addBody( borderend, "static", borderBodyElement )        
  
		 
    local function onLocalCollision( self, event )
            if ( event.phase == "began" ) then
				    local alert = native.showAlert( "You Passed The level!", "", { "Level2", "Main Menu" }, onBackComplete )
    
          end
    end
	
    ball.collision = onLocalCollision
    ball:addEventListener( "collision", ball)

    borderend.collision = onLocalCollision
    borderend:addEventListener( "collision", borderend )
Can anyone help me show the dialog box when the ball collides with the finish line but not every border I have?
emerson1234567890 is offline   Reply With Quote
Old 09-21-2011, 09:34 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 2
emerson1234567890 is on a distinguished road
Default

Can someone please reply because I waited for 3 months and I stil have this problem
emerson1234567890 is offline   Reply With Quote
Old 09-27-2011, 11:48 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2011
Location: California
Posts: 225
KarlJay is on a distinguished road
Default

Have you tried their tech support or forums? They should have some sample code online.
KarlJay is offline   Reply With Quote
Reply

Bookmarks

Tags
collision detection, corona sdk, dialog box, native.showalert

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: 412
11 members and 401 guests
AppleDev, chemistry, Emy, Gi-lo, ipodphone, mistergreen2011, pipposanta, Retouchable, skrew88, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,128
Posts: 402,923
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

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