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!

No comments: