cancel
 

 

Job type :

Zip Code :

community forums

Featuring over 100 topics of interest to DoItYourselfers.

Flash Professional 8 - How to Set Up the Elements of a Basic Game

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Video Transcript

In this lesson, we are going to be finding out how to setup the elements of a basic game which generally includes controlling some autonomous elements and setting up some user controls. Now, we are going to be making a bubble game and you can find this file in the lesson two folder part two and we are going to have bubbles on the screen and we are going to be using a pin to pop them. So, pretty simple but I think it will give us a field for how to kind of control these elements and how to manage them within your action script.

Now, I want to get things started by just setting up some basic controls. We have got a start button already in our library and I want to pull that on out into the stage and I also want to pull a bubble out so that we can try to setup some controls for it. We have got a display layer, so, let me use that for our start button here. We will drag that on out and I will just drop it into the corner and we will give that an instance name so we can address it. I will call it button start and let us make a layer for our bubble. We will just pop another layer in here for our bubbles and we will bring a bubble on out and give it a name as well.

Now, I am just going to set it on the corner of the stage so we can kind to see it if we test the movie and let us give that a name as well, we will call it MC for movie clip bubble and using what we already know, let us just setup a little control for this in action script. Now, I have already got some action started up in the actions layer here. So, let us click on that and bring up our actions panel and you will notice that I have already got some comments dropped in. Now, as our action script start getting a little more complicated, it is not a bad idea to organize things a little bit and using these comments if we set everything in the right spots for instance declaring our variables and handling our events, we will have everything in the correct order so that it will function properly.

Now, a lot of this is obvious, for instance, I need to declare a variable before I start handling events and using it in functions. But this kind of structure can help make things a little bit easier to find where something should go in the script. By all means feel free to copy this kind of structure or build it for your own action scripts as you progress on your own projects. Now, with that structure in mind, let us go ahead and declare the instances of the two objects we have on the stage and we will setup an event handler for them down in the event handling section. I am going to declare my instances using the bar keyword, and what do we got? We got a start button, so, we will just put that one in here first. That is going to be a button object and you can see how my help system is kicking in there. And we got our movie clip for our bubble.

Of course, that is going to be a movie clip title of an object. And remember, declaring our objects is going to help us in a couple of ways. One is, it will cue the hind system. So, whenever we are talking about MC bubble, this window already knows what type of object it is. So, it is going to be better able to pull up hints for us and kind to complete statements. Also, I have kind to found that it is a pretty good reminder of what kind of objects you are working with and what you name objects right in this window without having to close actions down and go back out into the main screen and look around.

Now, let us setup a quick event for that button. We will use a button start and we are going to do an on release handler and since the hint system is found release, I will just hit Enter there and we will setup our function syntax for that. And right inside that area, let us just move our button onto the stage. I will call it up MC bubble and we will access it _xproperty and I will just set it to a value that is somewhere in the middle of the screen like 300 or so, and we will do the same thing for the Y value. 200 should be around the middle of the screen and that should do it.

We can test our movie out, and of course, when we hit our button it is going to control that element and pull it to the center of the stage.
In this lesson, we are going to be finding out how to setup the elements of a basic game which generally includes controlling some autonomous elements and setting up some user controls. Now, we are going to be making a bubble game and you can find this file in the... click to read more


How to Build a Shoe Storage Bench

sponsored articles of the day

diy centers

Research and explore a wealth of wisdom on these topics