DragonFireSDK Forum

Programming Discussions => Game Programming => Topic started by: Micboy on January 23, 2013, 02:45:50 pm

Title: Lock levels if player has not completed earlier levels!
Post by: Micboy on January 23, 2013, 02:45:50 pm
Hi everyone,

I read in a different post that in the iphone simulator, placing a container over a button will allow the button to be pressed, but when built on the iphone, this is not possible.

Using this concept, should I place a lock image in a container over the button? (I want the button to still be visible, just not able to be pressed)

Thank you in advance,
Micboy
Title: Re: Lock levels if player has not completed earlier levels!
Post by: ciuffolo on January 23, 2013, 03:58:37 pm
Make a boolean variable like that:
Code: [Select]
bool start=false;

then if you want to be able to click it put in OnTouch event:
Code: [Select]
//your on touch event of the button:
if (start==false)
//do nothing, it's like you didn't press it
if (start==true)
//...do something....

then make start true when you want i the code, like after 3 seconds

Code: [Select]

OnTimer()
{
if (yourseconds==3)
start=true;
}

Hope this helped