News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

Question for my game

Farted by LynchClock, March 08, 2008, 09:45:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LynchClock

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.

TremcladClock

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.


LynchClock

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?

TremcladClock

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.


buttplug

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).

LynchClock

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?

LynchClock

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.

LynchClock

Never mind, I figured it out.

Loki Clock


RomanClock

lemayo lol :soups:

ChocolateBarClock

yay a new sig
[flash]http://cyberstrike.net84.net/shoot%20ronald%20macdonald.swf width=300 height=200[/flash]
Quote from: Jack O\'Neil;1267362your uncle took a shit in your wii
Quote from: TimeBeast (IRC)
<Timebeast> i need help eating nuts


^pure unicode^

Loki Clock

Quote from: ChocolateBarClock;1254818Use eq instead if ==

Stop filling his head with nonsense.