Tuesday, 15 November 2011

IDE

Integrated Development Environment is the name for an application program that can make codes to use on the internet, to make things like games and websites. Here at college we use the program Adobe Flash to do this, it's probably the most well known IDE and has many advantages.


Probably the best function of flash is actionscript, it enables you to write code that enables player interaction, for example drop and drag options, buttons ect. This is a massively useful tool that enables you to make interesting interactive games to varying degree's of difficulty, fortunately the program has pre-scripted elements that can be added to your coding to save time and make work easier. There are two different actionscripts to choose from, actionScript2 and actionScript3. Actionscript2 is slower but easier to learn at the start while actionScript3 is more difficult to learn but when you grasp the basics you can do some truly amazing things.


Flash comes with the ability to make vector images in the program without the use of programs like Illustrator, vector images are useful as they can be shrunk and expanded without quality loss, you can import vectors if you don't want to draw them in flash as well as uploading bitmap files, but these will pixelate when re-sized and have a larger file size then vector images. Also when you import an image you can store it in the library, it's very useful if you want to use the image more than once, you can edit the file in the library and it will add the edit to all the copies throughout the file, also if you make your image a 'movie clip' (using the F8 short-cut) you can go into the file and add new frames inside the file, making an animation without having to do it on the main time-line. Your animation inside the movie clip can also be controlled by code in the main time-line, which lets you play and stop when you want it to. You can also import movies into flash which is a very useful tool and flash also has a range of handy image adjustment tools and filters like opacity, drop shadow, stroke and so on. This is a quick way to add one small adjustment that immediately makes the image far better. Flash can also show animations through the use of frames, this can be used for such things as collisions, player interaction, button clicks, anything, which adds another dimension to your work and makes it more enjoyable for the people who use it.


Flash also has the ability to use sound, it even has a simple sound editor, sound can really enrich your work and make it stand out, also flash is compatible with loads of external computer hardware so you can use things like cameras, microphones, pressure pads, and many more. There's also a load of pre-set components which can be simply drag and dropped into your file, the components include things like buttons, scroll bars and dialogue boxes, which are very useful for beginners. As you get more experienced with flash you can do a lot more things, for example you can have flash access remote files via URL, which is useful for accessing high scores, also to reduce the program lagging you can have all the information you need on a single frame simply by having your files in the library and pulling them on stage when you need to using coding.


Also since flash is part of the adobe family it's compatible with many of the files you use when saving adobe work, you can even set flash to look more like Photoshop for beginners. Like Photoshop Flash also has layers, which are useful for placing objects on top or underneath each other, as well as folders, which are great if you are working with a lot of layers, you can just put all the related layers in a folder and close it, giving you more room to look at the other frames, it also can use colour code identification to help keeping layers organized.


In conclusion Flash is a very professional program that although horribly confusing at first can be used to make some amazing things once you get the hang of the program.



Thursday, 10 November 2011

Asteroid size

Today we added a small piece of code to our array file to make the size and rotation of the blocks random.

cube.scaleX=Math.random()*1.5+.1;
//This sets the x axis size to random anywhere between 1.5 and 0.1 (1 being the size of the original block)
cube.scaleY=Math.random()*1.5+.1;
//This does the same with the y axis size
cube.rotation=Math.random()*360;
//And this sets the rotation value to a random size between 0 and 360

Array development

Today we developed our Array file to make it more game-like. First we made a ship to direct with our mouse, so we made a simple box on the stage and converted it to a movie clip making sure that in advanced settings we clicked 'export for ActionScript' and called it 'ship' and set the class to 'ship', we then deleted it from the stage.


var Ship:MovieClip = new ship();
addChild(Ship);
//This drags our ship file onto the stage and names it Ship

Ship.startDrag(true);
Mouse.hide();
//drags Ship and hides mouse


Now our ship appears onto our stage and is clipped to our mouse. Part of the old code made the blocks go transparent with a hit test for our mouse so now when we roll over a block with our ship attached it goes transparent. This can be changed easily though to something like ship goes transparent or any other event so it's a very useful code that I will use in my game.

We also wanted to make the blocks scroll from the top to the bottom and loop back up to the top. With the code now 15 blocks show up randomly on the screen.

var speed=3
//Here we set the speed for the blocks, we could just set a fixed movement instead of using a speed variable but with a speed variable it can be changed so that the blocks get progressively faster. This piece of code is put at the top with the other variables


blockArray[i].y+=speed


//This talks to the whole Array and tells them to move along the y axis at the speed we set up in the       variable.

if (blockArray[i].y>450){
//if any of the blocks in the Array get to 50 pixels below the bottom of the screen
blockArray[i].y=-50
//move it to 50 pixels above the top of the screen
blockArray[i].x=Math.random()*550;
//then reposition it randomly along the X axis
speed+=0.1;
//And increase the speed by 0.1
}
}


This now means that every time the blocks go back up the the top of the screen they get as little faster.

Next we wanted to make the ship explode when it hits one of the blocks so we went into the movie clip from the library and on the next frame we drew a quick explosion with the pen tool, then on the frame after we delete the ship, we then leave a break of around 10 frames and then add she ship back in. Before we leave the movie clip we added a small bit of code (stop();) so that the clip doesn't play continuously.



We then simply added Ship.play(); to the end of the hit test code.

Finally we added lives to the game, first we made a square and converted it to a movie clip making sure that in advanced settings we clicked 'export for ActionScript' and called it 'lives' and set the class to 'lives'. We then went into the lives movie clip and made three squares in a line, then we made a new frame and deleted one of the squares and so on, then we added a stop to frame 1.

Finally we added this code (MovieClip(root).lives.nextFrame();) onto the last frame of the ship so when the ship is triggered to play it goes to the root (the stage), finds lives and moves it to the next frame.