First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: edmarriner | Website: http://www.edmarriner.co.uk
Variables What YOU need to know Part 1 If you are serious about making games in flash you NEED to know about variables. Variables have been use in almost every great game there has ever been! There used for things like money , lives , objects and LOADS more things to. So hopefully by the time you’ve read this tutorial you will know the basic’s of variables ! ------------------------ So in the first tutorial (this one) were going to make a money system ! (note: im working in flash mx 2004 pro , although this should work also with flash 5 , mx , mx 2004) Ok , so open up flash if you haven’t all ready. Make a new normal flash file. In the first key frame add this actionscript ; Money = 1000 This tells flash to set the Variable “money” which you just created to 1000. a Variable can be called anything and can hold letters and numbers . In this case its holing numbers. Now make a second layer and call it text . Then rename the other layer to shop. Click on frame 1 of layer text and make a dynamic textbox. On the text boxes properties were it says “ var: “ in the text box to the right type in money. This tells flash to show what ever the Variable money is holding in that text box. If you test the movie now the text box should say “1000”. Now make a button on the layer shop . Give the button this actionscript: on (release) { money -= 10; } Now test the movie again. When you press the button your money gos down 10 each time. You can also use thisaction script on the button; on (release) { money += 10; } This adds 10 to your money ! So how could you this what you have just learnt? Here just two ways; 1) make a shop 2) when you work at a shop you get paid i hop this was helpful and clear. ANY problems just email me at ed@edmarriner.co.uk Thanks ed
» Level Intermediate

Added: 2005-01-03
Rating: 7 Votes: 43
(10 being the highest)
» Author
im 12 , live in england :)
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • Mr.

    Posted by Brian on 08/13/2012 10:53am

    Hey, man, this was pretty good, taught me a lot. I'm curious, though, how do you keep the "money" counter from going below zero?

    Reply
  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.