Be a Supporter!

How do I make a level select

  • 745 Views
  • 7 Replies
New Topic Respond to this Topic
potatopower
potatopower
  • Member since: Feb. 24, 2010
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
How do I make a level select 2010-06-09 10:30:52 Reply

that unlocks when you complete a level?
My idea didn't work D:


AS3 programmer.
Learn AS3, it's for your own good.

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to How do I make a level select 2010-06-09 10:44:44 Reply

What was your idea? Simple way to do this is to have a boolean for every level.

var level1:Boolean = true;
var level2:Boolean = false;
var level3:Boolean = false;
...
...

When you finish level 1 you just set level2 to true and on the level select screen check with an if-clause what booleans are true and enable the level. You can also throw these booleans in an array if you know how to do that.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

potatopower
potatopower
  • Member since: Feb. 24, 2010
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to How do I make a level select 2010-06-09 10:57:39 Reply

nah I don't know how to do that but thanks for the help :D


AS3 programmer.
Learn AS3, it's for your own good.

potatopower
potatopower
  • Member since: Feb. 24, 2010
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to How do I make a level select 2010-06-09 11:02:35 Reply

my if statement has an error... my first time using booleans xD


AS3 programmer.
Learn AS3, it's for your own good.

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to How do I make a level select 2010-06-09 11:13:42 Reply

At 6/9/10 11:02 AM, potatopower wrote: my if statement has an error... my first time using booleans xD

Okay just give me two seconds while I concentrate really hard to read your mind and then solve the error for you...


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

potatopower
potatopower
  • Member since: Feb. 24, 2010
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to How do I make a level select 2010-06-09 11:29:47 Reply

thanks man... it worked.... the error is gone but it isn't working xD


AS3 programmer.
Learn AS3, it's for your own good.

Rapelsin
Rapelsin
  • Member since: May. 31, 2010
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to How do I make a level select 2010-06-09 12:57:32 Reply

Do it like this

var level1:Boolean = true;
var level2:Boolean = false;
var level3:Boolean = false;
...

if (char.hitTestObject(level1Goal)) {
level2 = true;
gotoAndStop("LevelSelect");
}

if(level2) {
level2_button.gotoAndStop("Unlocked")
}

I think that should work.


Rape l Sin or I R Apelsin, which ever suits me best...

Now I'll Trololo your face with an Apelsin!

DragonSnare
DragonSnare
  • Member since: Sep. 30, 2003
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to How do I make a level select 2010-06-09 15:30:09 Reply

yes that should work but I have read potato's mind and I have discovered that he has an MC labeled level2

isn't that right?


Flash games / Game creation tools

BBS Signature