SITE MOVING

NEW WEBSITE, I've moved everything to a new site. Its not just a blog anymore, its a full blown website.

REPEATE!: its not over just moving!

THE WEBSITE IS:
www.bxstudios.weebly.com

CHECK IT OUT FOR LOTS MORE TUTORIALS!

Welcome To Max's Flash Tutorials!

Here I will eventually post everything I know about flash. That ALOT! I am currently working on one of the best and far most interactive games I've ever made. Its called, "The Burbz RPG" and it will release some time in the summer of 08. That takes up a lot of my time but after I release the game on to the internet I will have a lot more time to write up tutorials.

Sections

Wednesday, January 30, 2008

Ways To Use Variables

There are many ways, and reasons, to use variables. In a game: if you want to be able to buy something, keep stats, keep count of something, or make a true or false clause. In a video, or music player: you might want to keep a play count or something that adds up. Those are some of the reasons you might want to use variables.
First we will start our with in games...

Buy Something:
(COPY AND PAST THE WHOLE SCRIPT)
  • //script written by stat for buying something, a watch
  • //view more scripts for free at www.max-flashtutorials.blogspot.com
  • on (release){ //on release of the button
  • if (watch == false) { //if you dont already have the watch
  • if (money>49) { //if the equals money is 50 or higher
  • _root.money-=50; //you spend fifty dollars
  • _root.watch = true; //you now have the watch
  • _root.watchbutton._alpha = 0; //the button to buy the watch is now invisible
  • } //ends money if
  • } //ends watch is false if
  • } //ends on realse part
  • //script by stat

Copy and paste that script on the button. You will have to change the names of the variables to comply with the ones your working with, and the "watchbutton" should be the istance name of the button to buy what ever you are dealing with. Leave anything after the "//" it will affect nothing but will be helpful to look back on latter if you forget what something does or want to write your own script.

Keep Stats:

(COPY AND PAST THE WHOLE SCRIPT)

  • //script written by stat for buying something, a watch
  • //view more scripts for free at www.max-flashtutorials.blogspot.com
  • on (release) { // on the release of the button
  • if (money>19) { // if your money equals 20 or higher
  • _root.intelligence +=1; //intelligence is uped by one
  • } //ends money if
  • } //ends on release part
  • //script by stat

Copy and paste that script on the button. You will have to change the names of the variables to comply with the ones your working with. Leave anything after the "//" it will affect nothing but will be helpful to look back on latter if you forget what something does or want to write your own script.

Everything else is pretty much the same thing, you just use different variable names...

Please comment if you have any questions!

Thursday, January 24, 2008

Basic Variable Tutorial

A Variable would be the numerous things that can effect a flash game, maybe its making and editing stats, maybe its buying things, or working an inventory. You can use variables to determine almost any thing, and they're really easy to use. Here I'll show you how to set and modify variables.
Helpful Tutorials:
  • Ways To Use Variables - A tutorial on all the places where you could put the AS for variable to serve your variable needs.
Setting Variables:
Setting a variable is MANDATORY in order for the variable to be modified correctly. If you run into your variable being "undefined" or "nan" than you forgot, or misspelled this step.
  1. First You should go to the very first frame of your game or the opening menu
  2. There you would apply the following action script:
  • var urvariable =1;
  • _root.urvariable -=1;

or...

  • _root.urvariable =1;
  • _root.urvariable=_root.urvariable -1;

Now the variable is set, to make this variable unique to what you want it to do, change "urvariable" to what every name you want it to be. We just set the variable to zero by saying one then subtracting it back down to zero. You must always subract one if you want it to be modified latter. So make sure you set the first number 1 higher than you actually want it to be.

Modifying Variables:

  1. Now you add this AS to a button or a frame, pretty much where ever you want the variable to change. (Helpful Tutorial)
  • _root.urvariable -=1;

or...

  • _root.urvariable+=1;

That will add one or subtract one from our variable we set earlier. Dont forget you need the "urvariable" part to be changed but the variable you set and the one your modifying have to have the same name or it will not work.

Another way to add to or subtract from a variable:

  • _root.urvariable=_root.urvariable-1;

or...

  • _root.urvariable=_root.urvariable+1;

HOW TO VIEW YOUR VARIABLE (IMPORTANT):

  • You must place a text box where you would like it to show.
  • Make Text Box
  • Click Properties
  • Change it from "Static Text" to "Dynamic Text"
  • Now right in your variable name where it says"Var:"

Now your done and you can test your game/movie.

Similar Tutorials That Would Help You Go Farther In This Subject:

  • Ways To Use Variables
  • True/False Variables

Sunday, January 13, 2008

Use Hit Test To Make Walls

Here I'll show you how to use hit test to make a wall in your flash game/movie. First you should probably have your character move so he/she can actually hit the wall. A hit test tells flash what to do once to objects have touched/collided. Like a man and a wall for instance.

If you haven't already viewed the following tutorial I suggest you do.
8 Way Movement Tutorial
  1. First make sure you gave your charector the instance name of "man"
  2. Then draw your wall (can just be a line if you want)
  3. Select your wall
  4. Hit "F8"
  5. Name your wall and select "Movieclip"
  6. Then click "OK"
  7. Now skip to the Action Scripting Section below

You will have to put a different action script based on the way your charector will be hitting the wall (from what side). He can hit it from the top, the bottom, the left, or the right. Choose below and add the opproperiate Action Script.

Hit From Above:

  • onClipEvent (enterFrame) {
  • if (this.hitTest(_root.man)) {
  • _root.map._y -=5;
  • }
  • }

Hit From Below:

  • onClipEvent (enterFrame) {
  • if (this.hitTest(_root.man)) {
  • _root.map._y +=5;
  • }
  • }

Hit From Left:

  • onClipEvent (enterFrame) {
  • if (this.hitTest(_root.man)) {
  • _root.map._x +=5;
  • }
  • }

Hit From Right:

  • onClipEvent (enterFrame) {
  • if (this.hitTest(_root.man)) {
  • _root.map._y -=5;
  • }
  • }

Thats It, Now Test Your Game/Movie!

Please let me know how this went for you...

Saturday, January 12, 2008

Simple 8 Way Movement

Here I'll show you how to add interactivity and make your charector in your game move in all eight dirrections with the arrow keys. Lets Begin...


  1. First draw you charector from a birds eye view (looking from above)
  2. Now Hit "Ctrl + F8"
  3. Now Name it and select "Movieclip"
  4. Then click "OK"
  5. Click on your charector and give it the instince name of "man"
  6. Now put the following script on your character:
  • onClipEvent (load) {
  • fight = false;
  • }
  • onClipEvent (enterFrame) {
  • if (fight == false) {
  • if (Key.isDown(Key.LEFT) && fight != true) {
  • _rotation = 270;
  • this._x -= 5
  • }
  • else if (Key.isDown(Key.RIGHT) && fight != true) {
  • _rotation = 90;
  • this._x += 5
  • }
  • if (Key.isDown(Key.UP) && fight != true) {
  • _rotation = 0;
  • this._y += 5
  • }
  • else if (Key.isDown(Key.DOWN) && fight != true) {
  • _rotation = 180;
  • this._y -=5
  • }
  • }
  • }
  • onClipEvent (enterFrame) {
  • if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
  • _rotation = 225;
  • }
  • if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
  • _rotation = 45;
  • }
  • if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
  • _rotation = 135;
  • }
  • if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
  • _rotation = 315;
  • }
  • }

And there you go! Now test your movie/game by hitting "Ctrl + Enter". That will create an swf file (thats the actual movie/game file that you would give to your friends or upload to the internet.

Basic Button Tutorial

Here is as basic of a way to make a simple button that when you click it you will go to another frame or attach any other type of action you want to occure when you click the button.
We'll start off by creating the button...
You can draw your own or get an already created on...

Make Your Own Button:
  1. Hit "Ctrl + F8"
  2. Name your button
  3. Then in the space provided, draw your button
  4. Now click "Scene 1" at the top of the page
  5. Now Hit "Ctrl + L"
  6. That will bring up your library, Now find the button you just made and drag it onto the stage.
  7. Now skip down to the Action Script Section to make your button do something
Already Created One:
  1. Open Flash
  2. Click "Window"
  3. Scroll down to "Other Panels"
  4. Then click "Common Libraries"
  5. And then Click "Buttons"
  6. You will get a pop up with all kinds of pre-made buttons
  7. Now skip down to the Action Script Section to make the button do something

The Action Scripting:

Now to make your button do something... the following script will make your button goto another frame...

First, put this script on the frame:

  • stop();

That will make your movie stop at this frame and not keep playing on.

Now Put this script on the button:

  • on (release) {
  • gotoAndPlay(2);
  • }

That means that when you release your click on the button, it will goto and play the frame number you put in the "( )". Of coarse to make this script specific to what you want it to do you will need to change the number in the "( )".

You can also put other actions in between the "{ }" to change variables, or anything else you would like to happen when you release your click on the button.

You can also put a different action inbetween the "( )" that says release. You can put "rollOver" to make it so when you roll over the button it will do the specific actions you set.