Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

corona sdk programming

Name: Anonymous 2014-03-19 14:55

Please I need some expert's help in checking/modifying the codes below so they work! For now the problem is when ball hits the balloons, the balloons won't disappear. The cannonball hits it and disappears.

function scene:createScene(event)
 local group = self.view
 
background = display.newImage( "bkg_clouds.png")
group:insert(background)
background.x = 230
background.y = 195
 
scoreText = display.newText( "0", 0, 0, native.systemFont, 32 )
scoreText:setFillColor( 0,0, 0 )
scoreText.x = 87
scoreText.y = 28
group:insert( scoreText )

questionText = display.newText('a', display.contentCenterX, display.contentWidth/4, native.systemFont, 40)
group:insert(questionText)

infoBar = display.newImage ("infoBar.png")
group:insert(infoBar)
infoBar.x = 10
infoBar.y = 25
 
restartBtn = display.newImage ("restartBtn.png")
group:insert(restartBtn)
restartBtn.x = 470
restartBtn.y = 300
 
cannon = display.newImage ("cannon.png")
group:insert(cannon)
cannon.x = 10
cannon.y = 270
 
cannon.anchorX = 0.5
cannon.anchorY = 0.5
restartBtn.isVisible = true

         local balloon = display.newImage ('balloon_fat_red.png', 495, 125)
         group:insert(balloon)
         balloon = display.newImage ('balloon_fat_red.png', 495, 175)
         group:insert(balloon)
         balloon = display.newImage ('balloon_fat_red.png', 495, 225)
         group:insert(balloon)
        
         local balloonText1 = display.newText('\227\129\130', 495, 125)
         balloonText1:setFillColor( 1,1, 0 )
         local balloonText2 = display.newText('\227\129\132', 495, 170)
         balloonText2:setFillColor( 1,1, 0 )
         local balloonText3 = display.newText('\227\129\134', 495, 225)
         balloonText3:setFillColor( 1,1, 0 )
        
         balloon.name = 'balloon'
         physics.addBody(balloon)
         balloon.bodyType = 'static'
         table.insert(balloons, balloon)        
       
         group:insert(balloonText1)
         group:insert(balloonText2)
         group:insert(balloonText3)



function ballCollision(e)
   if (e.other.name == 'balloon') then
            scene.updateScore()
            e.target:removeSelf()
            print ('remove balloon text')
            e.other:removeSelf()
            audio.play(pop)
        end
    end
   
function cannonCharge:touch(e)
  if(e.phase == 'began') then
        impulse = 0
        cannon.isVisible = true
        Runtime:addEventListener('enterFrame', charge)
    end
end
function charge()

local degreesPerFrame = 0.5
cannon.rotation = cannon.rotation - degreesPerFrame
     impulse=impulse-0.2
    
     if(cannon.rotation < -46) then
          cannon.rotation = -46
          impulse = -3.2
        end
end
function shot:touch(e)
    if(e.phase == 'ended') then
    
        Runtime:removeEventListener('enterFrame', charge)
        cannon.isVisible = true
        cannon.rotation = 0
       
        cannonBall = display.newImage('cannon ball.png', 84, 220)
        physics.addBody(cannonBall, {density = 1, friction = 0, bounce = 0})
        group:insert(cannonBall)
    
-- Shoot cannon ball
cannonBall:applyLinearImpulse(3, impulse, cannonBall.x, cannonBall.y )

--Collision listener
cannonBall:addEventListener ('collision', ballCollision)
   
    end
end


end

Name: Anonymous 2014-03-19 15:59

hax my anus

Name: Anonymous 2014-03-19 17:48

Use C#.

Name: Anonymous 2014-03-19 19:20

Use JPEG instead of PNG.

Name: Anonymous 2014-03-21 3:05

Read SICP.

Name: Anonymous 2014-03-21 9:11

Install TempleOS.

Name: Anonymous 2014-03-21 9:28

Hire some nigger programmers to help you.

Name: Anonymous 2014-03-21 9:58

where is your "normal ball" eventlistener?

Name: Anonymous 2014-03-21 10:00

and don´t JPEG instead of PNG.

Name: Anonymous 2014-03-24 14:27

Damn corona, now I need to rewrite the entire application to native. fucking freelance.

Name: Anonymous 2014-03-24 22:23

Put a lime slice in the bottle. It's still pretty lame but at least you'll get the vitamins.

Don't change these.
Name: Email:
Entire Thread Thread List