Tuesday, 29 November 2011

Flash As An IDE

(More to add)
Flash is a great integrated development environment
Flash is a multimedia programme that is used to create animations, video, flash games and interactive web pages.
Flash is also frequently used to create advertisements which can be found on websites with banner advertisements.

There are many advantages of using Flash programme, especially for animation or flash game development.
One advantage of using Flash with the Adobe Creative Suite is that any creations made in programmes like Photoshop or Illustrator can easily be transferred into Flash. For example graphics made in Illustrator can be easily transferred into Flash for a game you're creating. However Flash itself has tools to create simple objects and image manipulation tools to edit them, some examples could be shape tools, text and free transform tool which I feel is quite an important tool as you can reshape an image for example to the size you desire.
Vector images which is what Illustrator is used to create, 

Games developed in Flash have been very popular and this is often a choice for people who want to create games and be possible game developers as flash is a good start for new beginners and a great way to understand how to utilise their games and how game play works. Flash games work heavily on scripting with coding with ActionScript, the most recent version of this is As3 which is more efficient than it's predecessors.

Sound can also be incorporated into flash which can be used to add music or sound effects to a game. Sound effects can also be coded to only play at certain points or triggered by a certain event, for example a gun shot sound effect will only play when the fire key is pressed in a game.

Objects like images for a character or enemies can be stored in the flash library which allows the image to be reused again, this makes for efficient use of memory.

Like other Adobe software like Illustrator and Photoshop, Flash can also use layers which can allow more depth to be put into work, and keep things organized to a certain layer making it easier to organize and maintain

Coding can be used on just a single frame, so an large portion or possible an entire animation, game or other flash production could be done entirely on a single frame.

Through the use of scripting, MovieClips and Flash library, certain events can be triggered in an animation or game and then be brought from the Flash library onto the stage, for example a bullet from a gun, once the button is pressed to fire the gun, the bullet image can be brought on stage from the library and then the animation plays with the bullet moving across the stage and finally disappearing off stage once finished. This will then be repeated everytime the fire button is pressed. This is a great way to organise an animation or event into one area in the library which will then only be brought into action when called upon by scripting.   

Wednesday, 23 November 2011

Flash Game Development

The development of my game has so far been productive but quite difficult at times. But so far I feel I am on track to making the game to how I planned. I have been experimenting and learning new coding for my script that hasn't been taught throughout our class demo's. This has made a few problems while trying to piece coding together which has slowed down development a little, but overall it hasn't completely stalled and therefore the development is still going successfully.


Here is an example of how I managed to create coding so the zombies will spawn outside of the stage and then proceed to follow the Survivor(blue dot in the image).

Here is a screen grab of my experimentation of my attempt to make a gun for the survivor which became attached to the Survivor and therefore would stay on the Survivor when it would move. The coding in the script menu is an example of making the guns rotation, this is an example of how complex and complicated some of the coding can be. This allows the black gun to rotate to face where ever the mouse cursor is.

Thursday, 17 November 2011

Flash timer

var time:int=300

var myTimer:Timer = new Timer(1000, 300); //This is making the clock countdown one second from the clock, the 1000 represents 1 second and the 300 is for how many times it will countdown a second.
myTimer.addEventListener(TimerEvent.TIMER, runOnce);
myTimer.start();

function runOnce(event:TimerEvent):void {
time--
clock.text=String(time);
}

Thursday, 3 November 2011

Scripting

var blockArray:Array=new Array();

var Ship:MovieClip = new ship();
addChild(Ship);

Ship.startDrag(true)
Mouse.hide();


for(var i:int = 0; i < 15; i++) {
//Will duplicate the cube 15 times
var cube:MovieClip = new Box();
//This is looking for a new box in the libary
cube.x=Math.random()*550
//This is loading new cubes randomly on the x axis
cube.y=Math.random()*400
//This is loading new cubes randomly on the y axis, this works alongside the x axis too
addChild(cube);
//This is bringing a duplicate of the cube from the libary onto the stage

blockArray[i]=cube;

}

stage.addEventListener(Event.ENTER_FRAME, checkhit);
//Listen to the stage on every frame
function checkhit(myevent:Event):void {
for (var i:int = 0; i < 15; i++) {
//Creates a loop to create blocks 15 times.
if (blockArray[i].hitTestPoint(mouseX,mouseY,true)){
//If any of the cubes get hit by the mouse in it's x or y direction, true means the i from blockarray is following the cubes, so the cube that is hit by the mouse will cause the transparency(alpha) down.
blockArray[i].alpha=.3;

}

blockArray[i].y+=3;

if (blockArray[i].y>450){
   blockArray[i].y=-50;
   blockArray[i].x=Math.random()*550;

}
}

}


Wednesday, 19 October 2011

Flash game design

My idea for a flash game revolves around a zombie survival. This involves the player's character(The Survivor) having to survive wave after wave of increasingly difficult zombies that continue to chase the Survivor around the stage. The Survivor has to evade the zombies by moving around the stage and killing them off by shooting them. There will be multiple zombies on the screen at once. I have yet to decide whether the punishment for coming in contact with a zombie will be instant death or just rapidly deplete a health bar. I am also deciding whether the game will allow you to acquire new and better weapons. Much of what I would like to add to the gameplay will depend upon the time it takes to create the more necessary parts of my game, as I would be learning lots of new coding that haven't been taught to me through demo's.

Thursday, 13 October 2011

Collision detection demo

stage.addEventListener(Event.ENTER_FRAME, checkhit);
//Listen to the stage on every frame

function checkhit(myevent:Event):void {

cube1.x+=3
cube2.x-=3

if (cube1.hitTestPoint(cube2.x,cube2.y,true)){
//If any of the cubes get hit by the mouse in it's x or y direction, true means the i from blockarray is following the cubes, so the cube that is hit by the mouse will cause the transparency(alpha) down.
cube2.alpha=.3;

}


}

Array scripting demo

var blockArray:Array=new Array();


for(var i:int = 0; i < 15; i++) {
//Will duplicate the cube 15 times
var cube:MovieClip = new Box();
//This is looking for a new box in the libary
cube.x=Math.random()*550
//This is loading new cubes randomly on the x axis
cube.y=Math.random()*400
//This is loading new cubes randomly on the y axis, this works alongside the x axis too
addChild(cube);
//This is bringing a duplicate of the cube from the libary onto the stage

blockArray[i]=cube;

}

stage.addEventListener(Event.ENTER_FRAME, checkhit);
//Listen to the stage on every frame
function checkhit(myevent:Event):void {
for (var i:int = 0; i < 15; i++) {
//Creates a loop to create blocks 15 times.
if (blockArray[i].hitTestPoint(mouseX,mouseY,true)){
//If any of the cubes get hit by the mouse in it's x or y direction, true means the i from blockarray is following the cubes, so the cube that is hit by the mouse will cause the transparency(alpha) down.
blockArray[i].alpha=.3;

}
}

}

Thursday, 6 October 2011

Scripting demo 2

import flash.events.Event;
import flash.events.KeyboardEvent;

var moveRight:Boolean = false
var moveLeft:Boolean = false
var moveUp:Boolean = false
var moveDown:Boolean = false

var ship:MovieClip = new Ship();


 ship.x=275
 ship.y=200




addChild(ship);

stage.addEventListener(Event.ENTER_FRAME,moveShip);

function moveShip(event:Event) {

if (moveRight==true) {
ship.x+=3;
}

if (moveLeft==true) {
ship.x-=3;
}

if (moveUp==true) {
ship.y-=3;
}

if (moveDown==true) {
ship.y+=3;
}

}

//listen to keyboard being pressed.
stage.addEventListener(KeyboardEvent.KEY_DOWN,pressKey);
stage.addEventListener(KeyboardEvent.KEY_UP,stopship);

//if not pressed set move ship to false
function stopship(myevent:KeyboardEvent):void{
moveLeft=false;
moveRight=false;
moveUp=false;
moveDown=false;

}

//if pressed set move ship to true.
function pressKey(myevent:KeyboardEvent):void{
if(myevent.keyCode==Keyboard.RIGHT){
moveRight=true;

}

if(myevent.keyCode==Keyboard.LEFT){
moveLeft=true;
}

if(myevent.keyCode==Keyboard.UP){
moveUp=true;
}

if(myevent.keyCode==Keyboard.DOWN){
moveDown=true;
}
}

Wednesday, 28 September 2011

Basic navigation coding

stage.addEventListener(KeyboardEvent.KEY_DOWN, moveship);

function moveship(myevent:KeyboardEvent):void {
if (myevent.keyCode==Keyboard.RIGHT){
ship.x+=5;
ship.rotation+=5
if (ship.rotation>=90){
ship.rotation=90;
//This is an example of coding that allowed me to rotate the ship alot more smoothly. The coding above is done so the ship will turn until it reaches 90 degrees and then stops turning so the ship can carry on moving right without rotating.
}

}
// These coding's below are variations of the coding above, but now for the other arrow keys and their rotation. These were part of experimentation. After the first coding of the RIGHT key was shown to us I decided to experiment with what I learnt to finish the rest of the directional keys. I attempted to have all directional rotations to rotate to their correct position and then stop but I could only get the RIGHT KEY to do this.

if (myevent.keyCode==Keyboard.LEFT) {
ship.x-=5;
ship.rotation-=5
if (ship.rotation>=270){
ship.rotation=270;

}

}

if (myevent.keyCode==Keyboard.DOWN) {
ship.y+=5;
ship.rotation-=5
if (ship.rotation>=180){
ship.rotation=180;
}
}

if (myevent.keyCode==Keyboard.UP) {
ship.y-=5;
ship.rotation=0;
}

}

stage.addEventListener(Event.ENTER_FRAME,bounds);

function bounds(event:Event) {
if (ship.x>=550) {
ship.x=0;
// This allowed me to set a boundry for the stage, so when the ship would pass outside the stage boundary's it would appear out the opposite side of the stage. 
}



}

Flash Games Research

Space invaders














Space Invaders is a retro arcade game


Madness Interactive
http://www.newgrounds.com/portal/view/118826


















Portal: Flash Version
http://www.newgrounds.com/portal/view/404612


This is a flash game of the popular console game Portal. The game still focuses on the main gameplay elements of the console game by using the portal gun to overcome puzzle rooms which become increasingly difficult as you progress.