Another Countdown problem

Hello,

I know there are thousands of posts about countdown problems around,but I couldn’t find any that had my same problem or I didn’t look in the right place.

I am developing a game and I came up with a little problem.

As soon as you start the game the main character will collide against the sides and I would like to set up a visible countdown for the user with a displayed text. it should be posted somewhere in the code. But no idea were. I know it should be something with the timer.performWithDelay code but no idea how to connect it with each other.

So the countdown should serve to not let the user move yet until countdown has expired. Once expired the whole game should start moving like it should.
I hope I made my question clearly enough. :slight_smile:

Thanks in advance,
Yordano

local function initExample()
– Main Character
local sheet1 = sprite.newSpriteSheet( “Examplesprite.png”, 54, 64 )
local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 2)

sprite.add( spriteSet1, “Example”, 1, 2, 1000, 0 ) – play 2 frames every 1000 ms
Example = sprite.newSprite( spriteSet1 )

print(Example)
Example:setReferencePoint(display.BottomCenterReferencePoint)
Example.x = display.contentCenterX – 80
Example.y = H
Example.myName = “Example”

physics.addBody(Example, “dynamic”, physicsData:get(“sample_Example00”))
Example.isFixedRotation = true
Example.isBullet = true

Example.collision = onExampleCollision
Example:addEventListener( “collision”, Example )

Example:prepare(“JB”)
Example:play()

end [import]uid: 72218 topic_id: 15922 reply_id: 315922[/import]

have the Example:play() in a performWithDelay so that it will only start after a while.

If it is more than just the play() function, write a function that will start your game and call it in the performWithDelay

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15922 reply_id: 58872[/import]

Hi JayantV,

Thanks for your help as soon I saw you post I solved the problem.
It seemed that I didn’t insert the codes in the right places :slight_smile:
Anyways Thanks for your post.

Yordano [import]uid: 72218 topic_id: 15922 reply_id: 59045[/import]