Author Topic: Lock levels if player has not completed earlier levels!  (Read 1137 times)

Micboy

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-2
    • View Profile
Lock levels if player has not completed earlier levels!
« 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

ciuffolo

  • Guest
Re: Lock levels if player has not completed earlier levels!
« Reply #1 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