-1

ok so I have this.

local quotetap = 30
function changet() 
if tImage then tImage:removeSelf() end
if counterBlock then counterBlock:removeSelf() end

tImage = display.newImage( "images/tFaces_"..math.random(6)..".jpg",      264, 280 )
tImage.x = display.contentWidth * 0.5 
tImage.y = display.contentHeight * 0.5
counter = counter + 1

counterBlock = display.newText(counter, 30, 30, native.systemFont, 25)
counterBlock.x = display.contentWidth /7 *6
counterBlock.y = display.contentHeight /10



tImage:addEventListener("tap", changet) 
end

I want to add.

if (counter == quotetap) then
composer.gotoScene( "scenes.nextlevel", "fade", 500 )
end

mind you, the counter works perfectly. When add this however, i notice the friction when the counter hits 30. But it doesn't change scene like it should. After a slight pause, it just continues counting.

2 Answers2

0

ah I've figured out what's happening. Sorry for the meaningless question. Seems it actually is changing scenes. The scene i switch to is currently blank. So it actually is switching, and not clearing the old objects. So it appears that it is staying on the same scene, when it actually is not.

-2

You need to include the parameters (time, effect) in a params table. Look here https://docs.coronalabs.com/api/library/composer/gotoScene.html

Change

composer.gotoScene( "scenes.nextlevel", "fade", 500 )

To

local options = {
    effect = "fade",
    time = 500,
}
composer.gotoScene( "scenes.nextlevel", options )

Alternatively:

composer.gotoScene("scenes.nextlevel", { effect = "fade", time = 500, })
dannash918
  • 434
  • 6
  • 14
  • it works the way I had it though. I've been using it for several changing of scenes. I've tried what you said, but alas no response. – Stephen M. Yantz Sep 11 '15 at 20:16