| Actual |
Hubs | Hubbers | Topics | Request |
| #1 in Business | Subscribe Email Print |
|
You are here: Home > Computers and Technology > Games > Quick Article On Making A Flash Game |
|
Actual - Quick Article On Making A Flash Game
This step-by-step guide will show you how to make an Flash game quickly and easily This article is for people who are just beginning to use Flash tools to create interactive stuff. This article will take you from a blank flash document to an action game in minutes, with any tricky things explained in ordinary, everyday language that you can skip over if you want. So without further ado, let us fire up our favourite Flash tool. There are many tools available, so I will use Macromedia Flash as it is the most universally used tool. I recommend Sothink SWF Quicker to budding flash designers for creating flash applications and movies. This program According to USFDA, a combination product is one composed of any combination of a drug and device; biological product and device; drug and biological product is like an easy to use version of Macromedia Flash, and I have used this versatile tool to easily make a variety of applications. Setting the scene Create a new flash document (menu File/New) and save it as game.fla. This is the design file that will contain the design and content for the game. If you get stuck anywhere on this tutorial there is a finished game.fla at the bottom of this page that can be downloaded to see what things should look like. Change the document properties (menu Modify/Document) so that the dimensions are 640 by 480 and so that the frame rate is 30 frames a second. The background colour is assumed to be white. We will start by creating the 5 initial objects needed to make the game ; or drug, device, and biological product and fixed dose combination would include two or more combinations of drug. Examples of combination products may in work. Draw the player’s ship, the alien, the player’s projectile, the alien’s laser and an explosion on the same frame and layer. Turn each drawing into a Movie Clip with its own instance name. I will explain below in more detail how this is done. More advanced people can skip to the naming of the instances. How to turn a drawing into a Movie Clip: 1. Select the drawing by dragging a box around it. 2. Convert to a Movie Clip by going to the menu and then Modify or Insert depending on the Flash version. Choose “Convert to Symbol”. Alternatively you could use the shortcut by pressing F8. 3. Set the behaviour as Movie Clip and choose an appropriate name. This name is not the instance name. Click here for an lude drug-coated devices, drugs packaged with delivery devices in medical kits, and drugs and devices packaged separately but intended to be used together. illustration. 4. Select the new Movie Clip and in the properties panel at the bottom set the instance name to whatever is needed. The instance names are below: The Movie Clip for the player’s ship is called PlayerShip The Movie Clip for the alien is called Alien The Movie Clip for the player’s projectile is called PlayerShotT The Movie Clip for the alien’s laser is called AlienShotT The Movie Clip for the explosion is called ExplosionT Notice how there is a T at the end of certain instance names. This is a convenience to indicate that objects with a T at the end are to be used as templates for copies of themselves. This will be explained later. Let’s make things happen We’ll create some basic behavio here is enormous increase in the number of combination products entering the market in the recent years. Combination products have proven advantages but fixe urs for our Movie Clip objects next. At the moment the player’s ship isn’t too responsive. We’re going to change that. Left click on the player’s ship to select it. Go to the Actions panel at the bottom and enter in the following code in the white part on the right: onClipEvent(enterFrame) { if(Key.isDown(Key.RIGHT)) { //this will move the player 15 units to the right this._x = this._x + 15; } else if (Key.isDown(Key.LEFT)) { //this will move the player 15 units to the left this._x = this._x - 15; } } I’ll give some explanation below as to what this code means. Feel free to skip ahead of this explanation if you don’t want to get heavily involved in ActionScript. A bit about ActionScript: onClip d dose combinations are still in the process of convincing regulatory authority on their advantages over the single ingredient formulations. Combination pro vent(enterFrame){} This is basically a container that’s called a function. This container holds code to be run within it. The function isn’t executed or run until something else tells it to. “onClipEvent” is the name of the function. Some names such as “onClipEvent” are reserved by Flash in order for certain things to run properly. The text in between the two brackets “(“ and “)”are any parameters that are passed to the function. Parameters are passed from the source that executed it. There can be more than one parameter eg “(var1,test2)”. These parameters can usually be used within the function. Parameters will be described in more detail later. The stuff in between curly braces “{” and ”}” is the actual co ucts have become life saving products for the pharmaceutical companies who doesn’t have many innovative molecules in their product pipeline and have been inc e within the function that is executed. Things like “this._x= this._x + 15;” are called statements. Statements are bits of code that tells something to do something else. There is usually at most one statement every line. Every statement must end with “;” so that Flash knows when the statement ends. Comments are ignored by Flash, but help the coder know what their code is doing. Comments begin with a “//” and continue for the entire line. if(Key.isDown(Key.RIGHT)) {} This is called an if statement. This is basically a test to see if the stuff within the brackets is true. If the stuff is true then the code within the curly braces is run. else if (Key.isDown(Key.LEFT)) {} This can only go after the “if” stat easingly used in the product life cycle management. Even the companies having product patents are trying to extend their product life cycle through the combi ement or another “else if” statement. Basically, if the stuff in the previous test is false, then the stuff in this “else if” statement is tested. If the test in the brackets is true than the code within the braces is executed. This little piece of code will let you move the ship around from left to right. Preview your flash animation (CTR-ENTER) and try moving the ship with the left and right arrow buttons. The ship can move outside the boundaries so we need to add in a bit more code to restrict its movement. Change the line: if(Key.isDown(Key.RIGHT )) { to: if(Key.isDown(Key.RIGHT) and this._x < 640) { Also, change the line: } else if (Key.isDown(Key.LEFT)) { to: } else if (Key.isDown(Key.LEFT) and nation products and maximize the revenues. But the companies involved in this practice are overlooking that they are burdening the patients both economically this._x > 0) { Preview your animation again. This time the player ship should stay within the boundaries. Now would be a great time to place the player’s ship around the bottom of the stage, as it will be firing upwards. Time to breathe some life into the alien. Select the alien and put this code into the ActionScript part: //this is triggered when the clip loads onClipEvent (load) { xmove = random(15) - random(15); //comments can also go after statements ymove = random(15) - random(15); //this sets the ymovement randomly this._x = random(640); //this sets the x and y position randomly this._y = random(480); } //this is triggered everytime a new frame is entered, in this case 30 times a sec onCli and physically. They need to rightly judge the benefits of the combination products and they have to even look at the risks involved when combining the produ Event (enterFrame)
{
//lets move the alien around
this._x = this._x + xmove;
this._y = this._y + ymove; //bounce the alien if it is out of bounds if(this._x > 640){xmove = Math.abs(xmove) * -1} if(this._x < 0){xmove = Math.abs(xmove)} if(this._y > 480){ymove = Math.abs(ymove) * -1} if(this._y < 0){ymove = Math.abs(ymove)} } Try running the game now. The alien should select a random direction and speed and bounce around the stage. You should move the explosion, alien laser and player projectile off of the stage. This is because these are the templates that will be copied whenever necessary and so they will remain throughout the entire game. Time to give our ship some offensive weaponry. Select th ts. Some of the combination products were well accepted by physicians while others suffered. Companies involved in development of combination products are fi frame that you are working in. This should be the first one on the left. Go to the Actions panel at the bottom and insert the following code: //The stuff below this will only be executed once on this frame //This will create the arrays which basically stores stuff in numbered slots Explosions = new Array(); BadShots = new Array(); PlayerShots = new Array(); //This is to create the unique IDs PShotID = 0; BShotID = 0; ExplosionID = 0; //This is to create the playershot timer, so that it only shoots when ready PShotTimer = 0; //This one is required because each instance works on its own "layer" //Instances cant be on the same layer, hence the use of a unique ID UniqueID = 10; //This is to stop f ding difficulty in defining their combination products and facing various challenges from selecting a combination to marketing it. Following aspects would a rom entering the next frame in our timeline
stop();
//This stuff runs 30 times a second
this.onEnterFrame = function()
{
//timer goes down everytime the frame is entered again
if(PShotTimer > 0){
-- PShotTimer;
} //test for space key down if(Key.isDown(Key.SPACE)) { if(PShotTimer < 1) { //increment the unique id and id for playershots PShotID = PShotID + 1; UniqueID = UniqueID + 1; //loop back to 1 if there are many shots exisiting if (PShotID == 10) {PShotID = 1} //run function to make shot PlayerShots[PShotID]= MakeObject("PShot",PlayerShotT,UniqueID,PlayerShip._x,PlayerShip._y); //Set the timer so that the player must wait 10 frames before firing again PShotTimer = 10; } } } //f dd to the challenges in developing combination products: Which markets to tap where the combination products can do fairly well? Which combination prod nction to work out distance between objects
md = function (x1, y1, x2, y2)
{
x = x1 - x2
y = y1 - y2
var thing =Math.sqrt((x * x) + (y * y))
if (thing == 0) {thing = 999}
return(thing);
} //making instances or "copies" of the templates MakeObject = function(instname,template,id,x,y) { // make temporary variable var temp; //assign name var name = instname + id; //make new instance from template var temp = template.duplicateMovieClip(name, id); //set its x and y coordinates setProperty (name, _x, x); setProperty (name, _y, y); //return the object to whatever called this function return temp; } Double-click on your explosion that you made. Now convert the explosion again into a Symbol and cts are meaningful and rational? Which therapeutic categories to select? Which Combinations can address unmet needs of the patients? Do combin choose Graphic. You should now have a Graphic within a MovieClip for your explosion. Create an animation to your liking that basically plays out the explosion from start to finish. On the last frame, put this code in: this.onEnterFrame = function() { this.removeMovieClip(); } This will remove the explosion once it finishes its animation. Click here for an example. This won’t however remove the original explosion, only the instance. This is why you should keep this object away from the stage so that it is not seen. Go back to your scene by clicking something along the lines of Scene1 on the top left. Select the player’s projectile and insert the following code: //this is triggered when the clip loads tions increase the patient compliance? What would be the developing cost? How to tackle the risks encountered during combination product developmen onClipEvent (load)
{
xmove = random(5) - random(5); //comments can also go after statements
ymove = (random(5) + 15) * -1; //this sets the ymovement randomly
} //this is triggered everytime a new frame is entered, in this case 30 times a sec onClipEvent (enterFrame) { //lets move the player's shot around this._x = this._x + xmove; this._y = this._y + ymove; //destroy this if it reaches the top if(this._y < 0){this.removeMovieClip();} //test to see if this is colliding with the alien col = _root.md(_x, _y, _root.Alien._x, _root.Alien._y) //you can change 40 to another number if shots seem to pass through if(col < 40) { //increments the IDs and creates an explosion //notice that _root. is p t? As combination products don't fit into the traditional categories of drugs, medical devices, or biological products, the USFDA is in the process of devel t in front
++ _root.UniqueID
++ _root.ExplosionID
_root.Explosions[_root.ExplosionID] = _root.MakeObject("Explosion",_root.ExplosionT,_root.UniqueID,_root.Alien._x,_root.Alien._y); //"resets" the alien _root.Alien._x = random(640) _root.Alien._y = random(480) _root.Alien.xmove = random(15) - random(15); //comments can also go after statements _root.Alien.ymove = random(15) - random(15); //this sets the ymovement randomly //destroys this instance //once the instance is gone, no further actions can be performed this.removeMovieClip(); } } Run the game now and use SPACEBAR to shoot. By now your ship moves around, shoots and blows up the alien on a direct hit. Only a couple more pieces of code left! ping new procedures for reviewing their safety, efficacy and quality. Professional from academic institutions, pharmaceutical industries, health care indust The Endgame These aliens don’t come in peace, so select the alien and insert this code at the bottom, but before the end “}” brace: //this is to get the alien to fire randomly fire = random(20); //one in 20 chance of firing every frame! if(fire == 1) { _root.BShotID = _root.BShotID + 1; _root.UniqueID = _root.UniqueID + 1; //run function to make shot _root.BadShots[_root.BShotID]= _root.MakeObject("BShot",_root.AlienShotT,_root.UniqueID,_root.Alien._x,_root.Alien._y); } Finally, select the alien’s laser and add this code: //this is triggered when the clip loads onClipEvent (load) { xmove = random(5) - random(5); //comments can also go after statements ymove = (random(5) + 15); //this sets the y and representatives from various regulatory agencies are working out to design the regulatory requirements for manufacture and sale of combination products ymovement randomly
} //this is triggered everytime a new frame is entered, in this case 30 times a sec onClipEvent (enterFrame) { //lets move the player's shot around this._x = this._x + xmove; this._y = this._y + ymove; //destroy this if it reaches the top if(this._y > 480){this.removeMovieClip();} //test to see if this is colliding with the player col = _root.md(_x, _y, _root.PlayerShip._x, _root.PlayerShip._y) //you can change 40 to another number if shots seem to pass through if(col < 25){ //increments the IDs and creates an explosion //notice that _root. is put in front ++ _root.UniqueID ++ _root.ExplosionID _root.Explosions[_root.ExplosionID] = _root.MakeObject("Explosion",_root.Explo . As there is an increasing trend of the combination products companies manufacturing such products should be able to tackle the problems involved in the de ionT,_root.UniqueID,_root.PlayerShip._x,_root.PlayerShip._y); //"resets" the player's ship _root.PlayerShip._x = random(640) //destroys this instance //once the instance is gone, no further actions can be performed this.removeMovieClip(); } } Congratulations, you now have a functional game! Of course, this article barely scratches the surface of what is possible with Flash. Addicting games of some complexity can be made with the wonderful tool known as flash, and as your first glimpse into Flash game design I hope it has been enjoyable. As for what to do next, I suggest adding in a nice background in a layer underneath the current layer to get rid of the dull white, and perhaps to examine some of the elopment. They need to be wiser in analyzing the market trends and the regulatory requirements. Companies that provide selfless information through particip commented code that has been used. As a special thankyou for reading this article I’m giving the complete source of game.fla, which you can use for whatever purposes you want, private or commercial. You must however give credit to GameInnovator.com for using any part of the source in your projects. This flash file was made with Flash MX 2004. The complete source can be downloaded here I hope you have enjoyed following this guide as much as I have enjoyed writing it. After you have had a chance to sit back and absorb this article, please send us your comments and suggestions - your feedback is greatly appreciated. Written By Damien tion in industry events and feedback to regulatory authorities would be able to face the challenges and will be successful in developing combination products
HTTP = HTML link (for blogs, profiles,phorums):
Related Articles:Internet Marketing - Draw Traffic To Your Site With Content 188 Stage Hero's Journey (Monomyth)- Hero's Journey- Culprit Persuading People to Buy - Copywriting Questions Answered for a Business Owner - Part 2
|