A few hours late with this, but I wanted to add some things that I felt would improve it! I still need to update my blog with a couple other assignments from the class, which I will do very shortly.
The title of my game is called "MAZE!" and it's exactly that... two Maze levels that the player must navigate through using their mouse cursor without touching the walls. If the player touches the wall, it's game over and Jim Carrey will call the player a "pathetic loser." Once the player completes the first maze, the second one loads automatically. If the player makes it to the end of the second maze, Jim Carrey is much less mean but equally excited. Neither maze is MovieClip, but rather a button. When the cursor rolls over it, an action is triggered. In this case that action is calling in a new specific frame on the Timeline. A frame is frozen until an input is triggered using the "stop" command. Additionally, I animated a short intro that plays when the player first starts the game. The tune that goes along with it is two notes recorded in Garage Band on my iPad.
Link to Flash file:
https://sites.google.com/a/sou.edu/austin-gurwell-s-sfws/sfw-files/Maze.fla
Link to Flash file:
https://sites.google.com/a/sou.edu/austin-gurwell-s-sfws/sfw-files/Maze.fla
Here is the ActionScript code broken up by frame:
Frame 1 ("Click..." screen):
stop();
import flash.events.MouseEvent;
firstButton.addEventListener(MouseEvent.CLICK, startIntro)
function startIntro (event:MouseEvent)
{
gotoAndPlay("frame1");
var c = new Jingle();
c.play();
}
Frame 61 (instructions):
stop();
import flash.events.MouseEvent;
startGameBTN.addEventListener(MouseEvent.CLICK, startGame)
function startGame (event:MouseEvent)
{
gotoAndStop("Level 1");
}
Frame 62 (Level 1):
stop();
borderLevel1.addEventListener(MouseEvent.MOUSE_OVER, runOverBorder)
function runOverBorder(event:MouseEvent)
{
gotoAndStop("End Game");
var a = new loser();
a.play();
}
endGame1.addEventListener(MouseEvent.MOUSE_OVER, endLevel1)
function endLevel1(Event:MouseEvent)
{
gotoAndStop("Level 2");
var c = new alrighty();
c.play();
}
Frame 63 (Level 2):
stop();
borderLevel2.addEventListener(MouseEvent.MOUSE_OVER, runOverBorder2)
function runOverBorder2(event:MouseEvent)
{
gotoAndStop("End Game");
var a = new loser();
a.play();
}
endGame2.addEventListener(MouseEvent.MOUSE_OVER, endLevel2)
function endLevel2(Event:MouseEvent)
{
gotoAndStop("Game Won");
var b = new theGame();
b.play();
}
Frame 64 (Winner screen):
stop();
restartBTN2.addEventListener(MouseEvent.CLICK, restartGame2)
function restartGame2 (event:MouseEvent)
{
gotoAndStop("Start");
}
Frame 65 (Loser screen):
stop();
restartBTN.addEventListener(MouseEvent.CLICK, restartGame)
function restartGame (event:MouseEvent)
{
gotoAndStop("Start");
}
Project 5: First Game
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.ui.Mouse;
import flash.media.Sound;
public class GameTime extends MovieClip {
//Global Variables
var player:MovieClip;
var ball:MovieClip;
var birdsArray:Array = new Array;
var vx:Number=0;
var vy:Number=0;
var maxAngle:Number;
public var speed:int;
public function GameTime()
{
// constructor code
//Make birds
makeBirds();
//Hide the mouse
Mouse.hide();
// Fill variables
player = new Snake;
ball = new Apple;
ball.vx = 5;
ball.vy = 5;
maxAngle = 15;
trace("Les do dis!!!");
//Add stuff to stage
addChild(player);
addChild(ball);
player.x = stage.stageWidth * .5;
player.y = stage.stageHeight * .85;
ball.x = stage.stageWidth * .5;
ball.y = stage.stageHeight * .1;
player.scaleX = .2;
player.scaleY = .2;
ball.scaleX = .15;
ball.scaleY = .15;
//event listeners
addEventListener(Event.ENTER_FRAME, onEnterFrame);
} //end constructor function
//Event Handler and other functions
function makeBirds():void
{
for (var i:int = 1;i>=0;i--){
var tempThing:MovieClip;
tempThing = new Thing();
tempThing.y = Math.floor(Math.random()*stage.stageHeight);
tempThing.x = Math.floor(Math.random()*stage.stageWidth);
tempThing.vx = 3;
tempThing.scaleX = .2;
tempThing.scaleY = .2;
trace("tempThing"+i+"vx = " + tempThing.vx);
trace("tempThing"+i+"vy = " + tempThing.vy);
addChild(tempThing);
birdsArray.push(tempThing);
}
}
function onEnterFrame(event:Event):void
{
{
// move things
moveThings();
moveThing(ball);
player.x = mouseX;
player.y = mouseY;
boundaryBounce(ball);
checkCollision(player, ball);
}
function moveThings():void
{
var tempThing:MovieClip;
for (var i:int = birdsArray.length-1;i>=0;i--){
tempThing = birdsArray[i];
tempThing.x -= tempThing.vx;
}
}
function moveThing(objectA:MovieClip):void
{
objectA.x += objectA.vx;
objectA.y += objectA.vy;
}
function checkCollision(objectA:MovieClip, objectB:MovieClip):void
{
if(objectA.hitTestObject(objectB))
{
objectB.vy = -objectB.vy;
objectB.vx = getCollisionAngle(objectA, objectB);
}
}
function getCollisionAngle(objectA:MovieClip, objectB:MovieClip):Number
{
//returns a new objectB.vy based on where objectB hits objectA
var relativeX:Number = objectA.x - objectB.x;
var relativePercentage:Number = (relativeX/objectA.width)*2;
if (relativePercentage > 1)
{
relativePercentage = 1;
}
if (relativePercentage < -1)
{
relativePercentage = -1;
}
var newVx:Number = -(relativePercentage * maxAngle);
// DEBUG CODE
if (objectB.x < 0)
{
objectB.x = 1;
objectB.y = objectA.y - 20;
}
if (objectB.x > stage.stageWidth)
{
objectB.x = stage.stageWidth-3;
objectB.y = objectA.y - 20;
}
return newVx;
}
function boundaryBounce(objectA:MovieClip):void
{ //STAGE COLLISIONS
if(objectA.x > stage.stageWidth || objectA.x < 0)
{
objectA.vx = - objectA.vx;
}
if(ball.y > stage.stageHeight || ball.y < 0)
{
objectA.vy = -objectA.vy;
}
}
}
}
}
Project 4: Animation Nation
Check it.
It's hard to recall three interactive events in my life that touched me the most. But I'll try.
1. Going to Disneyland for the first time when I was eight years old. Never in my life up to that point had I been able to interact with so many different fun, physical, real things. Disneyland has been dumbed down a bit over the years, and I was lucky enough to have had the chance to see Tom Sayer's Island in its fully open, explorer-friendly form.
2. Playing Grand Theft Auto III for the first time. This was back in my middle school days. The PS2 had just come out and people were unsure of what GTA3 would be. I hadn't been following the game closely before its release and rented it after it came out. Love at first car jacking. Never had I played a game that offered so much freedom to the player and with such amazing humor. I quickly bought the game and for weeks my friends and I talked about nothing but GTA. "So what did you do in GTA last night?" "I hit an old lady in the face with a baseball bat."
3. Dark Brotherhood quest in ESIV Oblivion where you're locked in a house full of people you need to kill. This quest in Oblivion made me really appreciate the amount of work that goes into games that most people will overlook and never see again. The quest begins with the player entering an old manor. The owner has set up a "contest" for some acquaintances he needs to get rid of. He has told them that treasure has been hidden somewhere in the house but that nobody can leave until it's found. The player assumes the roll as one of the contestants but must kill each person. What's amazing about this quest is it can be done in literally DOZENS of ways and each one is totally different. If you make friends with someone in the house, they will be more likely to suspect someone else of a murder instead of the player. And if they're convinced they know who the murderer is, they'll attack that person. Depending on the friends or enemies you make within the house, it's different every time.
There are probably much more significant events than these but these are what came to mind.
Project 5: First Game
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.ui.Mouse;
import flash.media.Sound;
public class GameTime extends MovieClip {
//Global Variables
var player:MovieClip;
var ball:MovieClip;
var birdsArray:Array = new Array;
var vx:Number=0;
var vy:Number=0;
var maxAngle:Number;
public var speed:int;
public function GameTime()
{
// constructor code
//Make birds
makeBirds();
//Hide the mouse
Mouse.hide();
// Fill variables
player = new Snake;
ball = new Apple;
ball.vx = 5;
ball.vy = 5;
maxAngle = 15;
trace("Les do dis!!!");
//Add stuff to stage
addChild(player);
addChild(ball);
player.x = stage.stageWidth * .5;
player.y = stage.stageHeight * .85;
ball.x = stage.stageWidth * .5;
ball.y = stage.stageHeight * .1;
player.scaleX = .2;
player.scaleY = .2;
ball.scaleX = .15;
ball.scaleY = .15;
//event listeners
addEventListener(Event.ENTER_FRAME, onEnterFrame);
} //end constructor function
//Event Handler and other functions
function makeBirds():void
{
for (var i:int = 1;i>=0;i--){
var tempThing:MovieClip;
tempThing = new Thing();
tempThing.y = Math.floor(Math.random()*stage.stageHeight);
tempThing.x = Math.floor(Math.random()*stage.stageWidth);
tempThing.vx = 3;
tempThing.scaleX = .2;
tempThing.scaleY = .2;
trace("tempThing"+i+"vx = " + tempThing.vx);
trace("tempThing"+i+"vy = " + tempThing.vy);
addChild(tempThing);
birdsArray.push(tempThing);
}
}
function onEnterFrame(event:Event):void
{
{
// move things
moveThings();
moveThing(ball);
player.x = mouseX;
player.y = mouseY;
boundaryBounce(ball);
checkCollision(player, ball);
}
function moveThings():void
{
var tempThing:MovieClip;
for (var i:int = birdsArray.length-1;i>=0;i--){
tempThing = birdsArray[i];
tempThing.x -= tempThing.vx;
}
}
function moveThing(objectA:MovieClip):void
{
objectA.x += objectA.vx;
objectA.y += objectA.vy;
}
function checkCollision(objectA:MovieClip, objectB:MovieClip):void
{
if(objectA.hitTestObject(objectB))
{
objectB.vy = -objectB.vy;
objectB.vx = getCollisionAngle(objectA, objectB);
}
}
function getCollisionAngle(objectA:MovieClip, objectB:MovieClip):Number
{
//returns a new objectB.vy based on where objectB hits objectA
var relativeX:Number = objectA.x - objectB.x;
var relativePercentage:Number = (relativeX/objectA.width)*2;
if (relativePercentage > 1)
{
relativePercentage = 1;
}
if (relativePercentage < -1)
{
relativePercentage = -1;
}
var newVx:Number = -(relativePercentage * maxAngle);
// DEBUG CODE
if (objectB.x < 0)
{
objectB.x = 1;
objectB.y = objectA.y - 20;
}
if (objectB.x > stage.stageWidth)
{
objectB.x = stage.stageWidth-3;
objectB.y = objectA.y - 20;
}
return newVx;
}
function boundaryBounce(objectA:MovieClip):void
{ //STAGE COLLISIONS
if(objectA.x > stage.stageWidth || objectA.x < 0)
{
objectA.vx = - objectA.vx;
}
if(ball.y > stage.stageHeight || ball.y < 0)
{
objectA.vy = -objectA.vy;
}
}
}
}
}
Project 4: Animation Nation
Check it.
It's hard to recall three interactive events in my life that touched me the most. But I'll try.
1. Going to Disneyland for the first time when I was eight years old. Never in my life up to that point had I been able to interact with so many different fun, physical, real things. Disneyland has been dumbed down a bit over the years, and I was lucky enough to have had the chance to see Tom Sayer's Island in its fully open, explorer-friendly form.
2. Playing Grand Theft Auto III for the first time. This was back in my middle school days. The PS2 had just come out and people were unsure of what GTA3 would be. I hadn't been following the game closely before its release and rented it after it came out. Love at first car jacking. Never had I played a game that offered so much freedom to the player and with such amazing humor. I quickly bought the game and for weeks my friends and I talked about nothing but GTA. "So what did you do in GTA last night?" "I hit an old lady in the face with a baseball bat."
3. Dark Brotherhood quest in ESIV Oblivion where you're locked in a house full of people you need to kill. This quest in Oblivion made me really appreciate the amount of work that goes into games that most people will overlook and never see again. The quest begins with the player entering an old manor. The owner has set up a "contest" for some acquaintances he needs to get rid of. He has told them that treasure has been hidden somewhere in the house but that nobody can leave until it's found. The player assumes the roll as one of the contestants but must kill each person. What's amazing about this quest is it can be done in literally DOZENS of ways and each one is totally different. If you make friends with someone in the house, they will be more likely to suspect someone else of a murder instead of the player. And if they're convinced they know who the murderer is, they'll attack that person. Depending on the friends or enemies you make within the house, it's different every time.
There are probably much more significant events than these but these are what came to mind.