doubling the amount of rubies required to save the life

Hey guys

Now suppose my character loses then they can have choice of playing again with the same score, but with 1 ruby…then if they play again with 1 ruby, the very next time they loose, they should pay 2 rubies to play again with the same score…then the third time it should be 4… then 8 and so on…

how can i do this ??

Thanks

Akash 

and i store the value of rubies in user.json as “key”…i.e user.key = blah blah…

so if the keys are reduced during "play again ", then it should save my keys to user.json 

local currentCost = composer.get(“lifeCost”)

if currentCost == nil then

    currentCost = 1

else

   currentCost = tonumber(currentCost)

   currentCost = currentCost*2

end

composer.set(“lifeCost”, tostring(currentCost))

I didnt understood anything
Elaborate

If Current Cost does not exist, set it to 1 “ruby”, this is for the first time the player pays, if it exists, which it will after the first payment, then for every time the player wants to try again it doubles the price.

if currentCost == nil then --(first payment)

    currentCost = 1

else

 

else --(all payments after one will increase by double every time)

   currentCost = tonumber(currentCost)

   currentCost = currentCost*2

end

and i store the value of rubies in user.json as “key”…i.e user.key = blah blah…

so if the keys are reduced during "play again ", then it should save my keys to user.json 

local currentCost = composer.get(“lifeCost”)

if currentCost == nil then

    currentCost = 1

else

   currentCost = tonumber(currentCost)

   currentCost = currentCost*2

end

composer.set(“lifeCost”, tostring(currentCost))

I didnt understood anything
Elaborate

If Current Cost does not exist, set it to 1 “ruby”, this is for the first time the player pays, if it exists, which it will after the first payment, then for every time the player wants to try again it doubles the price.

if currentCost == nil then --(first payment)

    currentCost = 1

else

 

else --(all payments after one will increase by double every time)

   currentCost = tonumber(currentCost)

   currentCost = currentCost*2

end