Maze game in Flash
Hey guys, this is Maad 101, and today we have a special guest, and he's going to show you how to make a maze game in Flash. I'm going to show you what I mean by that. Um, really quickly, we programmed this game, and um, if you lose, it'll play the "you lose" screen.
You have to keep your mouse in this um, white area, and if I go and I play properly, just hold on one sec, it'll say "I won." If I lose, if I lose by going in the pink area, it'll say "you lose." So now, um, our special guest is going to be showing you how to make this in Flash CS4. So let's get started.
Hi guys, uh, so I'm going to be using uh, ActionScript 2, not ActionScript 3. So, um, because I'm not going to draw out all this stuff for you, I'll just copy it from this file. Um, and so, if you just have this shape here, I'll convert it to a movie clip.
Um, and then I'll open up the actions and then write in "on rollover, gotoAndStop(2)," and frame 2 will be the um, the "you lose" screen. Okay? And um, for the wins, for the "you win" screen thing, I'll instead... I'm not going to write the text there, I'll just um, I'll just make a um, button here, and I'll convert that to a button.
I'll make it an invisible button by putting it on only the hit thing, not the up, over, or down, and it'll look blue, but in your actual exported Flash movie, you won't see it at all. So now I'm going to um, I'm just going to actually copy this and paste it in here and write "gotoAndStop(3)."
And so now I just need to write in um, I'll put a stop function in there so that it just stops the movie from playing the go, the lose or win. In frame 2, it'll say "you lose," and in this frame, it'll say "you win."
So now we test that. You should go here, and then if you roll over... hold on a sec. Oh, sorry, um, I forgot to put in the actions uh, that it says instead of "gotoAndStop(2)," it's "root.gotoAndStop(2)" because it's a movie clip. That's one of the disadvantages of movie clips.
Uh, yeah, but buttons, you can just write "gotoAndStop" and it should work fine. So now if I test this, if you roll over here, it says "you lose," and if you go over through the maze and roll over that part, it says "you win."
And uh, that's the end of this tutorial. Okay, so thank you for watching, and goodbye...