View Full Version : How to tell Flash not to repeat a frame...?
NSENGLE
03-20-2009, 11:45 AM
i used to do a lot of simple flash animations 3-4 years ago (the old random stick figure violence lol). i just now started to get back into flash recently.
i have flash 8 professional and im still new to everything...(i hope im in the right forum for this..)
so here's the question for you (i hope i can explain it correctly);
how do i get flash to know when frames have been played already thruugh an interactive (button clicking) game?
Example:
-I have a game where you click buttons to find items and "clues"
-when you enter one room you can find "clue 1"
-and when you enter another room you find "clue 2"
-and when you enter another room you find "clue 3"
-and so on...
*but you must have found all clues before you can enter the last room..
the tricky part for me is...how do i tell flash that when all clues/items are found? i want a button that becomes available so you may enter the room.
please point me in the right direction!
Thanks
kkbbcute
03-20-2009, 03:35 PM
Code it like this, create an array with all the indices set to 0. When you go to a certain frame containing a room, then say something like array[0] = 1, and so on and so forth, swapping the array index for every new room. Then when the user enters the last room, run a if else script to check if all of the array indices are all one, if they are, play the frame, else go to a frame that says something like "More clues needed".
Hope this helps.;)
NSENGLE
03-20-2009, 09:54 PM
hey, thanks for responding!
although what you've said has given me an idea of what i need to do, i still dont know how to do any of the actual coding...maybe i should take it to a different forum because now...my guess is that it would be getting too technical to be asking for help with as2 in here...
BUT, if you could maybe varify exactly where i can go to find help with arrays concerning my conditions..that would be great!
or if you can help me yourself that would be even better :D
ok so hoping you chose the above option ...heres my questions because i dont kno how to make this work...do i put the same exact array codes in each of the frames with rooms in which they have to visit b4 proceding to the final room? what does an array code look like? what does the 0 mean? lol
i hope you can explain,
thanks
kkbbcute
03-21-2009, 01:22 PM
//Put the following on your first frame
myArray = [0, 0, 0, 0];
var i:Number = 0
var numRooms:Number = 4
var notVisitedAll:Boolean = false
//Then execute the following when you go into room one
myArray[0] = 1;
//Execute this is room two
myArray[1] = 1;
//Execute this is room three
myArray[2] = 1;
//Execute this is room four
myArray[3] = 1;
//When user enters last room, execute the following,
while (i < numRooms) {
if(myArray[i] == 0) {
notVisitedAll = true;
}
i++
}
if(notVisitedAll == true) {
notVisitedAll = false;
//gotoAndPlay the find more clues frame
} else {
//play winning frame
}
NSENGLE
03-22-2009, 12:13 AM
this makes sense to me!
Thanks!!!
but a cuople questions about this script, can the "i" be any other letter??? just a bit confused with that :confused: ..also, after i click the button to go into the final room it does bring me to the frame that says u must find the key and enter all rooms alls i have to do is go back and then click that button again and im allowed to go into the final room without visitin the others! loool!!
the bad thing is...im jst tryin to learn this stuff thru a seperate flash file that isnt even my main project right now!! :sigh: is this scripting business really as hard as it looks??? is it easy to learn? i feel like giving up .. haha
So can you help me with something else?
i want it so that you must visit all rooms AND get the key (dissappears from stage or goes to bottom of stage and acts like an inventory..) ... the key is a button named "key" lol
kkbbcute
03-22-2009, 07:54 AM
i can be anything you like. Also,
after i click the button to go into the final room it does bring me to the frame that says u must find the key and enter all rooms alls i have to do is go back and then click that button again and im allowed to go into the final room without visiting the others!
Why would you want to do that? Anyway, just add a new Boolean variable and change it when you press, and onPress, use a "if" statement to check if the Boolean value has been changed, if so, you can access the room without visiting the other rooms.
NSENGLE
03-22-2009, 09:52 PM
ok cool thanks.
but i dont think you understood what you quoted...because thats not what i wanted ... thats what happend after putting the scripts in exactly how you said ... if u like i can send you my test .fla if u wish to see for yourself =]
i want it to do this;
You must visit all rooms and get the key.
kkbbcute
03-23-2009, 12:53 PM
Doesn't sound too hard, you could try attaching the fla to your next post. :)
NSENGLE
03-23-2009, 04:49 PM
its actually a .fla that was in my other thread in actionscript 2.0 forum...name of thread is "Arrays..." i believe you've already commented on it...but if u like i can upload the one that i edited with your script ... doesn't matter to me :)
kkbbcute
03-24-2009, 09:13 AM
its actually a .fla that was in my other thread in actionscript 2.0 forum...name of thread is "Arrays..." i believe you've already commented on it...but if u like i can upload the one that i edited with your script ... doesn't matter to me :)
Okay, anything will do, will try to solve things as soon as possible.
NSENGLE
03-25-2009, 04:00 AM
Hey, i've a new question. it concerns my main project.
I'll PM you about it instead of putting it here.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.