Timer doesn't work properly

Hi; 

Nick, do you have any empathy? Or You have lots of time for writing pointless sentences. Or you like this kinda behaviour of it by writing  “That’s a great way to get people to help you bla bla …” . Please be serious because you are really helpful to loose my view angle of corona sdk.  My question is above.

@yusufkaratoprak, everyone here really wants to be helpful. I know I personally want you to succeed. Sometimes people ask for help and perhaps language barriers get in the way. I’m willing to do what I can to help you with in reasonable constraints.  Let me try to address a couple of these.

First and foremost you want people to run your code but it’s impossible for me to do so. I do not have your main.lua, config.lua, build.settings and all of your scene files. You’ve only posted a couple of them above. I also don’t have any images or sounds that your app may be using. No one here can “make up” the missing pieces.

In 95%+ of the time, we don’t need to run your code to debug it. Part of debugging is recognizing a problem by the results you get. It’s not foolproof by any means, but it works quite well. We also can read and trace code and follow the logic. If we see something out of place, then there is a good chance we can diagnose and offer a suggestion based on the code alone.  Sometimes it helps to see screen shots of the problem or potentially a video displaying the problem.

If you want to bundle up your app and put it in a .zip file and share it, then we could run your app and see what the problem is. Many developers don’t want to share their app, so we have to fall back to screen shots, videos and descriptions. When we are limited to descriptions the better the description the more help it will be.

Now you posted two blocks of code. You named both of them in the post “scene2.lua”, so I don’t know what is really scene2.lua and what is either scene1.lua or scene3.lua, which you indicated also exist. But I think I’ve spotted the problem and the advice to call composer.removeScene(“scene2”) would certainly remove your buttons.

It appears that you’re using a widget.newTabBar() for your buttons. Are you wanting those buttons to always be on the screen and visible? I think you do. The rest of this will be based on that assumption.

When you are constructing a user interface (UI) that uses tabBars at the bottom and perhaps a title bar at the top, you generally want those around regardless of what makes up the rest of the scene. When this is a case, you do not want these to be a) part of a scene and b) managed by composer.

Tabbars are best created in main.lua or a non-Composer module that’s ran as part of main.lua. Objects that are not part of a scene sit on top of the display in what we call HUD or Heads Up Display mode. They will always be on top and always visible.

Consider moving your tabbar code to main.lua and see if that makes things work more like you think it will.

Rob

Hi;

i prepared my project as ZIP. there are 2 issues. one issue.

scene0.lua has one play button. (ok)

scene1.lua has platform,balloon and jumping physics.

scene2.lua has play button (PLay again) and score.

first issue is after playbutton of scene2 by clicking physics in scene1 is not working properly.

second isue is play again not working in second game playing. i mean i can not playgame more than twice.

i added my project as ZIP. Click below link.

https://upterabit.com/6sl/corona_MultiScreen.zip

Basically you are not removing scenes before you go to this. This is an odd concept. But you a) cannot remove the scene you are currently in and b) if you don’t remove them anything in the scene’s main chunk won’t run a second time. Most of your object creation is done in the main chunk, starting physics etc. With out removing the scene these things won’t happen again. Any way fix #1:

In scene2.lua in your code that handles the tabBar buttons, you need to remove scene1 before returning to scene1:

local bottomTabButtons ={   { width=50, height=32, defaultFile="play.png", overFile="playhover.png", onPress=function() composer.removeScene("scene1"); composer.gotoScene( "scene1" )  end},   { width=50, height=32, defaultFile="quit.png", overFile="quithover.png", onPress=function() os.exit() end}, }

Then in scene1.lua, you need to remove scene2 before you go to it:

local function timerDown( event ) print("timer çalışıyor") timeLimit = timeLimit-1 timeLeft.text = timeLimit if(timeLimit==0)then timer.pause( event.source ) currentscore = currentscore + tapCount composer.removeScene("scene2") composer.gotoScene( "scene2", { effect = "fade", time = 800, params = { level="Level 1", score=currentscore } } ) end end

That should get you past the problem you’re currently experiencing. 

thanks! it is done. everything is working…