Clock Crew

Community => Flash & Flash Accessories => Topic farted by: LynchClock on March 08, 2008, 09:45:35 PM

Title: Question for my game
Post by: LynchClock on March 08, 2008, 09:45:35 PM
Whats wrong with this code:

__
stop();
password = inputText
if ( password == "levelone" ){
     _root.gotoAndPlay(18) ;
} else if ( password == "leveltwo" ){
     root.gotoAndPlay(25);
}
__

When I type the "levelone" in the input box it takes me where I want it to, but when I type "leveltwo" it does nothing. What am I doing wrong? Thanks for your time in advance.
Title: Question for my game
Post by: TremcladClock on March 08, 2008, 09:48:31 PM
Where do you have this code defined? The IF statement has to be constant in order for it to check if the correct password is entered.

Either attach the IF statement to a button or place it in the enterFrame area of a movieclip. It's not going to work if it's in the LOAD area or placed on a frame.
Title: Question for my game
Post by: LynchClock on March 08, 2008, 09:55:57 PM
Quote from: TremcladClock;1247810Where do you have this code defined? The IF statement has to be constant in order for it to check if the correct password is entered.

Either attach the IF statement to a button or place it in the enterFrame area of a movieclip. It's not going to work if it's in the LOAD area or placed on a frame.

I'm not going to lie, I'm really confused. Right now I have the input box on the menu screen of my game. I have a button next to it that takes you to a certain frame that has the code. I tried putting the IF statement in a button and had no luck. What should I do?
Title: Question for my game
Post by: TremcladClock on March 08, 2008, 10:05:57 PM
Quote from: Holy Diver;1247825I'm not going to lie, I'm really confused. Right now I have the input box on the menu screen of my game. I have a button next to it that takes you to a certain frame that has the code. I tried putting the IF statement in a button and had no luck. What should I do?

The best answer I could give you is "learn actionscript", seeing as you probably copy/pasted this code from somewhere and have no idea how it works. There are plenty of tutorials out there that'll tell you how to do this:
http://www.oman3d.com/tutorials/flash/password_bc/

Lots more on Google.
Title: Question for my game
Post by: buttplug on March 08, 2008, 10:10:44 PM
I think it would be better if he started in C++ or VB or something, just to kind of learn how code works (assuming he knows nothing about it).
Title: Question for my game
Post by: LynchClock on March 08, 2008, 10:12:20 PM
Thanks for the tutorial, but its exactly like the one I read before I started. If you were making a game that had level codes how would you set it up?
Title: Question for my game
Post by: LynchClock on March 08, 2008, 10:12:45 PM
Quote from: ButtplugClock;1247840I think it would be better if he started in C++ or VB or something, just to kind of learn how code works (assuming he knows nothing about it).

I already know vb, I took a class for it.
Title: Question for my game
Post by: LynchClock on March 08, 2008, 10:23:15 PM
Never mind, I figured it out.
Title: Question for my game
Post by: Loki Clock on March 09, 2008, 02:09:28 AM
No _ on second root.
Title: Question for my game
Post by: RomanClock on March 13, 2008, 04:50:11 PM
_
Title: Question for my game
Post by: ChocolateBarClock on March 16, 2008, 01:02:07 PM
Use eq instead if ==
Title: Question for my game
Post by: Loki Clock on March 19, 2008, 02:33:03 AM
Quote from: ChocolateBarClock;1254818Use eq instead if ==

Stop filling his head with nonsense.