Sunday 29 May 2011

Finished game

Thought I'd post a link to the finished game that I posted on my DeviantArt page, I'm really happy with how well received it's been:  http://steffne.deviantart.com/gallery/#/d3hdv85

Friday 27 May 2011

Conclusion

I've had a lot of fun making this game, it's extremely near completion so I'm definitely going to keep going with it. Hopefully I can have it up and fully running by later tonight/tomorrow. This is the most challenging thing that I've created in AS3, I'm surprised that I managed to achieve what I did! It's been very fiddly at times, I'm very grateful that I created a flowchart as it really helped me get my head around what I exactly needed to be doing at times. I think if I were to redo this again I'd have liked to have gave myself some more time for research and preproduction. However I have been working on it non-stop since receiving the assignment, so I'm not too sure how I'd have managed to squeeze anything else in! Overall very pleased with myself and hope to keep furthering my knowledge in AS3.

Variables

Here is a list of the variables I've used in the game:


//booleans
var herbhaircollect:Boolean=false;
var herbfridgecollect:Boolean=false;
var herbcircuscollect:Boolean=false;
var bookherbcollect:Boolean=false;

var strawberrydrawercollect:Boolean=false;
var henhousestrawberrycollect:Boolean=false;
var barnstrawberrycollect:Boolean=false;
var medicinestrawberrycollect:Boolean=false;
var bookstrawberrycollect:Boolean=false;
var treestrawberrycollect:Boolean=false;
var mudstrawberrycollect:Boolean=false;
var plantpotstrawberrycollect:Boolean=false;
var haystrawberrycollect:Boolean=false;
var strawberrymirrorcollect:Boolean=false;

var henclick:Boolean=false;
var geteggs:Boolean=false;

var cakecolour:int = 0;

As I mentioned before, the majority of these were used to stop items from reappearing and being recollected.

The henclick is so that when the hen has jumped out the tree, it stays vanished from the main environment.
The geteggs is for when you close down the farmers speech, he sends the eggs to the bakery for you.
The cakecolour stores a number which is used to help determine which frame of the birthday cake to go to (directs you to the right colour.)

Character movement

I'll stick to explaining the key points here or else it'll get confusing.
On the down button press, Calvin switches to facing forwards.
On the up button press, Calvin switches to facing backwards.
On the left button press, Calvin switches to facing left.
On the right button press, Calvin switches to facing right.
This is done through gotoAndStop codes. 

When Calvin gets 200 pxls to the left/right of the screen, 
the background starts scrolling with the movement of Calvin.

In this chunk of code there's parts that mention wellies which might look confusing to someone else looking at this.
This is here because in the barn you can click on the wellies and Calvin will wear them,
you can't walk through the mud until you wear these. 
The wellies are always on Calvins feet, but on alpha=0 
Calvin wears the wellies when the alpha = 1 and he is then able to pass the coordinate cut off point where the mud is.

There's also a part about ladders,
when ladders2 alpha =0 , on the up key press Calvin can go up the ladders.
The left and right keys are disabled when Calvin goes up the ladders as Calvin just goes invisible when the ladder animation occurs.
(It'd look pretty strange if Calvin stayed at the bottom of the ladders,
while a seperate animation of him was climbing up the ladders at the same time!)
When Calvin gets to the bottom of the ladders (animation over) Calvin reappears on the main stage
and his left and right movement is free to move again.

Password boxes


Razzles password
For Razzle's password, you find a note in his toolbox with a picture of snakes. As this doesn't say a specific word, I didn't want to be too strict on the password. So this is why I have more than one password that works on this box, I've also added the password in a mixture of lower and uppercases. When you press the guess button, it closes down the menu (hides with alpha:0 and moves coordinates) if you have the correct password he will say so- then give you his ladders as a reward. The ladders reward pops up when you close his dialogue box (the actionscript is hiding in the speech dialogue movieclip.) If you guess wrong then he'll say it isn't right. You can then close down his speech box, click on him again and the password menu will pop up. This menu will keep doing this until you guess the password correctly. Once you've obtained the ladders from Razzle his speech bubbles alpha will go to 0 so that you can't talk to him anymore. 


Pincode



This works the same as Razzles password, just not as complex since there's only 1 working password. You obtain this password through the hospital patient, it's her thankyou gift for making her better.

Code explanation

I thought I'd firstly explain the basic structure of my code. There's quite a lot of it now and printscreening it all and putting it into this blog might be a bit of a challenge! I'll try my best though. 

I've added a lot of comments into my code which has been a great help for myself when coming back to the code after a break. A lot of my tasks can only happen under certain scenarios or if a specific item has been collected, it has been very confusing to work with at times. The majority of my game runs through if statements and booleans, which are simple enough. But like I mentioned since there's so many specific circumstances that things can happen, it's been difficult for me to get my head around at times. I'm very pleased I made my flowchart at the beginning of this assignment, as it has been a huge help! I crossed off each task as I completed them. 

Collecting items -
When you click on an item, the alpha is lowered and it's coodinates are moved. (this applies to closing down menus too)
If the item is collectable then it goes into the pocket inventory, into it's corresponding box.  
The first frames of these boxes are blank, the second show the item that has been collected.
Two of my items (strawberries and herbs) have counters on them, 
so when you collect an item it adds one to the correspondong number. (herbbox + berrybox)
I also have an award menu that pops up as an extra bit of feedback so that you know when you've collected an item. 

I had an issue with collectable items reappearing once you leave the room and come back. 
To fix this issue I added in variables for each item, so when the variable is true the item stays off stage and alpha: 0 

Here is an example of how the award menu and collecting a herb works:

function fridgeherb3(evt:MouseEvent):void {
herbhave++; // plus 1 to herb counter 
herbfridgecollect=true; // refers to variable, this stops the herb from being recollected and reappearing
environment.fridge.fridgeherb.x+=1000; 
environment.fridge.fridgeherb.y+=1000; //moves herbs coordinates
award.gotoAndStop("herb");//moves to herb award popup 
award.alpha=1;//makes awards visible
award.x=stage.stageWidth/2;//moves award to halfway point on stage
award.y=164; //moves awards to this y coordinate point
if (pocketinventory.box6.currentFrame==1) { // if you haven't collected a herb yet then
pocketinventory.box6.gotoAndStop(2);//switch to second frame so that herb appears in inventory
}

}

Talking to characters - 
This was by far one of the most confusing parts. I have just one movieclip with all character dialogue listed- and an animation previous to show the speech bubble pop up. I didn't originally have this animation pasted in at the front of every piece of speech, but I ended up getting a bug where it struggled to find the spoken text after playing the animation. To fix the problem I added the animation at the beginning so that it wouldn't have to fuss around looking for 2 separate things. 

I also have all the close speech code inside this movieclip, which ended up causing a few extra issues since the rest of my code was on the main timeline. If I ever made another game on this scale I'd definitely stick to keeping all the code on the main timeline. When looking for a null object error, I found it a nightmare looking around so many pieces of code dotted around all over the place.

This is an example of how the character dialogue code works:

function pom1(evt:MouseEvent):void {
if (strawberryhave >=10 && henclick == true) { //if you have 10 strawberries and eggs
environment.speech8.gotoAndPlay(302); //talk to pom- she'll ask what colour cake you'd like
} else {
environment.speech8.gotoAndPlay(130);//talk to pom - she asks for 10 strawberries and eggs
}
}




Wednesday 18 May 2011

Custom Cursor


Tutorial used: http://danielmclaren.com/node/96
You can see it hovering over the hospital doors.
I'm very pleased with the outcome of this cursor, when you hover away from the flash file the cursor disappears.
Then reappears when you move back onto the game.
I've had issues with this in AS2 where even when you hovered off the flash file- the cursor image would still stay on-screen.

Character lineup

Tuesday 17 May 2011

Start game

Here are some screenshots from when you first start playing the game.


Flowchart

As my story has a lot of little tasks that tie in together, it can get very confusing to keep up with.
I designed this flow chart to help me keep track of what order the tasks need to go in.

Friday 6 May 2011

Story Plot

START GAME
Receive a list of tasks to complete for Sunshine's birthday party.
A brief tutorial will then pop up explaining the basic mechanics of the game.

Task list

As this is a point and click adventure game, it means a lot of tasks will have to be completed in order to complete other tasks. Which could potentially get very confusing for myself, so I've made a basic template for how the storyline will flow. I'm not perfectly sure whether it'll be clear to an outsider reading this as it is in a brief noteform. Nevertheless it has helped me keep track of what I'm doing.
Tasks:

go to hairdresser (can see music) > Needs shampoo for clowns wig

go to bakery > need to collect __ strawberries and eggs > when complete get cake

go to circus (can see balloons) > Need the clown back > when clown returns recieve balloons

go to barn > lost hen > give hen and recieve eggs > find wellies > able to get strawberry

go to doctors > *patient in bed* >  needs 5 herbs for a herbal remedy > once recieved patient is better > rewards you with a present
doctor: thanks you for helping his patient, both can attend party now.

go to calvins house > shampoo

*ladders propped up against a building with Razzle the red bear doing work on a roof* > he'll loan you the ladders> get hen

Character dialogue

talk to blinky "Wahh! The show starts soon and I don't have my wig! How can someone even manage to lose shampoo?"
talk to blueted "I can smell strawberries! Feed me one and I'll give you this card."
talk to steffne "My customer is waiting inside and I've lost the shampoo!"
talk to patient pom: "I really want to make it to Sunshine's party! Please help me get better!"
talk to doctor cloud: "If only I could find 5 herbs, that should be enough to make her some medicine."
talk to razzle: "Huh! Can't you see I'm busy up here? What! You want my ladders?!" yes/no
yes: "Oh fine. But be quick, I haven't finished the roof yet."
no: "What was all that about?" *mutters under breath*
talk to farmer: "Eggs? My hen ranaway last night. Can't have eggs unless there's a hen to lay 'em, kid."
talk to baker: "A birthday cake? How splendid! I'll need 2 eggs and 10 strawberries. You didn't expect it for free did you?"


When given Steffne the shampoo: "Oh my gosh! THANKYOU. I shall wash the wig instantly! Here's the stereo too, you really earned it!"
When Blinky returned to circus: "The show was amazing! Thanks for your help, that Steffne is a real klutz. Here, have some balloons!"
When given Blueted a strawberry: "Om nom nom nom nom, that was delicious. Oh yeah the card, here you go."
When given hen to farmer: "HENNY! Promise me you'll never runaway like that again. Now give us some eggs!"
when given baker eggs and strawberries: "Yay you did it! I'll quickly get these baked up for you in no time!"
When given Doctor herbs: "Wow you managed to find them all? That's very impressive. Now me and my patient can both attend Sunshine's party too!"
patient: "I feel better already! I can't wait to party."

Collectable items
These are the items that can be collected in your inventory.

card - blueted
present - hospital
balloons - circus
stereo - hairdressers
strawberries - hidden
cake - bakery
herbs - hidden
ladders - razzle
shampoo - in calvin's house

Thursday 5 May 2011

Inside buildings

This is inside the Hairdressers. 

I've added button code animations on all the drawers. One has a hidden item inside.
I'll add more of these interactive objects and hide them all over my town. 

Tuesday 3 May 2011

Opening doors

I've added in an extra frame for the doors so that when you walk into them they'll pop open. Overall giving off a better illusion that you'll be walking into a building- and not magically appearing inside. 

Game menu

This is what my menu screen looks like. There are 3 buttons in the right hand corner. Pocket Inventory, Notepad Task list and Help.

This is what pops up when you press the Pocket icon. All of the items that you have collected during the gameplay will appear here. 



This is what pops up when you click on the little notepad icon. It contains a list of all your main objectives that you need to collect in order for the Birthday party to commence.

This is an example of what will happen once you have collected one of these items.
A little cross will appear in the box next to that task.

Sunday 1 May 2011

WIP images






I'll use this post to store all my Work In Progress images.
The AS I mentioned earlier is applied, so the character can walk around the enviornment. 

Character turnaround

Calvin

Idea progression

This was a very quick sketch I did at the very beginning of this project. Originally it was just going to be an interactive environment targeted towards children's. Instead of using this idea I expanded on it to turn it more so into a game, with aims and goals. 

Preproduction Mindmap Plan

This was too big to scan in so I've taken a photo of it from my mobile phone. 
  • There's a very rough sketch across the top of what I want the side scrolling environment to look like. 
  • Sketches of the front/back/sides of my character. 
  • Rough sketch of an inventory menu that will pop out. 
  • A task list for the character to complete, certain parts must be done in a specific order.
  • Button controls- up, left, right key controls + mouse click 
  • Interactive environment. Click on objects to find things and talk to other Characters for clues. 
  • Brief explanation of Story plot- Themed around a characters birthday. Calvin (the main character) must complete his to do list and find a birthday cake, balloons, a stereo and a present. Once all these items have been found, the party will commence and the player will win.
  • Software I'll be using- Flash. 
  • Coding in Actionscript 3 

AS coding progress


I've been working on a code that will enable the background to scroll and the main character to walk at the same time. It works so that when the character gets so many pixels towards one side of the screen, the background will then move so many pixels to either the left/right (depending on the direction of the characters movement.)
There is also a gotoAndStop code to change the image of my character to match the left/right walking position.

This is a reference I used to help write this code: http://www.8bitrocket.com/2007/9/2/Flash-CS3-Actionscript-3-AS3-Game-Primer-2-Asynchronous-key-detection-for-arcade-games/

Friday 29 April 2011

Product research

These games are ones that I have found to have a similar concept and target audience to my idea.
These are:
Mechanics from these games that I like are:
  • Side scrolling
  • Item collecting and Storage space
  • Clickable environments 
  • Left and Right arrow key Character controls



The Idea.

For my INP project I would like to produce a point and click style adventure game.
In this game you will have to interact with the environment and other characters in order to solve tasks, the game will end when all the tasks have been completed.
This will be a 2D sidescroller produced in AS3 coding with Adobe Flash.
My target audience will be females between the ages 8-13.