Tuesday, 15 April 2014

Working Processes: Creating the Game - Fixing glitch, Adding a camera angle, Adding bin contents/ receipt and Drawing notebook

The first thing I done was fix the glitch as reported from the user feedback.

The glitch would occur after you have taken the glasses from the coat. The user would then change the camera angle and then back again, it is here where the coat would appear again and the user would be able to take a new pair of glasses.

In order to do fix this, I have created a boolean so that when the item has been picked up, the coat will disappear.

On the timeline, the following code has been used.

if(glassesFound){
    roomView.coatHanger.itemGlasses_btn.visible=false;
}

This will be applied each time the user goes to that frame, so it can be sure that another coat will not appear.

I also added another camera angle, this was of the vending machine. In order to create this vending machine camera angle, I found the appropriate angle in my sketchup document and took a screen shot. I then imported this into Flash and traced around it.




I changed the appearance of the vending machines buttons to suit the context of my game. I also created a screen which would notify the user messages. There is also now a series of numbers and letters the user can type in added all the appropriate buttons to link to this camera angle.

On frame 2 of the vending machine, I opened the cage door. This would happen once the user has used the right key on the padlock of the door.

In the process of adding this camera angle, I changed it so that the lightbulb can not be picked up from the desk, but instead whilst facing the vending machine itself (since you're nearer).

There are now two ways to face the vending machine, from rotating on to it from the main camera angle, or by getting to it from the desk camera angle.

I then gave the bin, under the desk, a script so that it would produce a receipt when it is clicked on. I then applied the drag feature from the lightbulb and key onto the receipt so that I could drag it.

I added hit tests for the key and vending machine lock so that the cage would open.

I am yet to add one to the receipt and vending machine, which would be done tomorrow.


I then drew the notebook open and added contents inside of it. This was done as a movieclip which has it's own layer and is applied to all the frames of the Flash apart from the Name Enter. This is so that the notebook can be open and read anytime.

The user will be required to wear the glasses they've picked up, otherwise the notebook will not be readable as it will be blurred instead.

Monday, 14 April 2014

Working Processes / Planning: Feedback from User Testing [1]

When showing others my unfinished game for feedback, I received the following.

Feedback Type Solve it by Importance
Unlimited Glasses from Coat Glitch Fix glitch Extremely
Unclear moving mouse left and right to rotate around room Feature Instructions Very
Window looks like Chalkboard or a big TV Art Add trees/ moons Mild
Don't know how to make inventory appear Feature Instructions Very
Surgeon / Dr Paphitis placed on 2nd Door Art Adding it Mild
When username and password wrong = message Feature Adding error message Moderate

I will fix and correct to these in the order of importance that they have to the game.
To me, I believe that the glitch is most important to solve as it could break the game.

Working Processes: Creating the Game - Adding 2 Camera angles, Cursor changes and Item features.

I added two camera angles, cursor changes when hovering over items in the inventory and made it so you could drag the key out the inventory.

1) The picture frames
2) The door

These two camera angles currently have no scripting. It is likely that the picture frames camera angle won't have any button scripting, other than going back to previous camera angle, as they are just there to look at.

The main door will have scripting so that the door would be able to be opened once an item is used on it and some booleans have been set to true.

I have inserted different cursors into the cursor movieclip is that a wider selection is available. This is not for the user to choose which cursor they want, but as a way of indicating which item does what.
In the inventory, if an item is draggable, a hand will appear.
If the item is only suppose to be clicked on, then the pointer cursor will appear.

Finally, I made it so that the key, which is received from the drawer, can be dragged from the inventory, just like the lightbulb was.

The code used is exactly the same just with different instance names and functions.

For the cursors, I used this website to help me:
http://kirill-poletaev.blogspot.co.uk/2010/07/mousecursor-property-in-actionscript-3.html



Sunday, 13 April 2014

Research - Finding a song

I would like a song to play when the user plays this game.

The song can't be something which distracts the user, but instead creates an atmosphere for the game.

I've searched around and there's two songs which stand out to me.

Song Name Description Link
Fall Of The Awakened This song creates a very good atmosphere and sounds like a song which would be used for problem solving in games with puzzles. This will work very well with my game. However the song changes at 1:20 and becomes much more upbeat - which will not work with the game I am creating. Since, if used, the duration would just be 1:20 this is too short for a game like mine. If set on a loop in Flash, it wouldn't work well as there would be a clear indication where it begins and ends. /audio/listen/573019
Let It Go (Short) This song has an entirely different atmosphere. It does not so much represent a problem solving puzzle vibe but more so gives an impression that all is not right. Which would work well with my game as there is a character to is lost and has trouble finding out where he is and who he is. /audio/listen/566042

Out of the two, I believe Let It Go would be best suited  for this. Mainly because it's good throughout and the loop works perfectly. Loops are particularly important with games.


Saturday, 12 April 2014

Working Processes: Creating the Game - Fixing the inventory issue

To fix my inventory issue, I changed my code from this (with booleans):

function ifFullPassItem():void {
    if(!itemBox1Full){
        bottomBar.barItemBox1.gotoAndStop(itemInQuestion);
        trace(itemBox1Full);
        itemBox1Full = true;
    } else if (itemBox1Full){
        bottomBar.barItemBox2.gotoAndStop(itemInQuestion);
        trace(itemBox1Full);
        itemBox2Full = true;
    }
}


To this (with vectors):

function ifFullPassItem():void {
    for (var i:uint = 0; i < 7; i++) {
        if(i<inventorySystem.length){
            bottomBar["barItemBox"+(i+1)].gotoAndStop(inventorySystem[i]);
        } else{
            bottomBar["barItemBox"+(i+1)].gotoAndStop("itemNothing");
        }
    }   
}


I have uploaded both versions of the game in order to show what has changed.

The Waiting Room [V1]
The Waiting Room [V2]

You will notice that there are overlays as buttons, instead of buttons on the actual items. I done this so that I would only need one symbol for the buttons. When publishing the final version, these buttons shall be made transparent, not in the alpha filter, but inside the symbol with the fill colour set to 0% alpha.

In order to see the difference between the files, please do these steps.

Enter your name
Click on the Computer
Click on  the lightbulb on the chair
Drag the lightbulb, from the inventory, onto the lamp
Press back
Click on the coat to retrieve the glasses
Notice that...
In the old version the glasses get entered into the 2nd inventory slot instead of the 1st, even though the 1st is free.
In the new version the glasses transfer into the first slot







Also by redoing this script with a more complex formula, if both items were in the inventory (glasses in the 2nd slot) and then the lightbulb is removed, the glasses will move into the 1st slot. This is something which I had spoken to my supervisor Dan about, where I stated it may not be something I will be able to accomplish due to it's complexity.

I used this Adobe page on Vectors to learn how to use them and created the code myself
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Vector.html

Friday, 11 April 2014

Planning: The Inventory so far and the concerns

With the inventory I have created, some problems have arisen which I did not think would happen.

For my inventory I have the same movieclips, repeated 7 times, with different instance names.
I have the following code for it:

function ifFullPassItem():void {
    if(!itemBox1Full){
        bottomBar.barItemBox1.gotoAndStop(itemInQuestion);
        trace(itemBox1Full);
        itemBox1Full = true;
    } else if (itemBox1Full){
        bottomBar.barItemBox2.gotoAndStop(itemInQuestion);
        trace(itemBox1Full);
        itemBox2Full = true;
    }
}

This code is not complete, and would carry on till itembox7.

This code helps the items know which movieclip the item would be placed it, but it doesn't acknowledge which of those movieclip instances the item is in.

This means that I will not be able to take out items once they are used and this will create unnecessary item space.

I did consider adding a if barItemBox1=itemLightbulb gotoAndStop("itemNone") else if barItemBox2=itemLightbulb gotoAndStop ("itemNone") to the item. However this would make the code very long, especially as it would be repeated for each item.

I will need to change the code accordingly so that it will work well with removing items.

Working Processes: Creating the Game - Using items from the inventory

In my game, there comes a point that you will use the lightbulb, from the inventory and drag it to connect to the lamp.

It sounds like a reasonable straightforward code of startDrag and stopDrag with a hitTest, however this is not the case.

Since my inventory items are inside movieclips, this has made the process a lot harder.

Here is the code I have created:

//moveLightbulb
var lightbulbMove:lightbulbClass = new lightbulbClass();

stage.addEventListener(Event.ENTER_FRAME, lightbulbMoveListener);
function lightbulbMoveListener(event:Event):void {
    if(lightbulbGrab==1){
    trace("Lightbulb grab is grabbed (stage check) | " +lightbulbGrab);
    addChild(lightbulbMove);
    lightbulbMove.startDrag();
    lightbulbMove.y=mouseY;
    lightbulbMove.x=mouseX;
    lightbulbMove.z=1;
    lightbulbMove.visible=true;
    cursor_mc.visible=false;
    stage.removeEventListener(Event.ENTER_FRAME, lightbulbMoveListener);
    stage.addEventListener(Event.ENTER_FRAME, lightbulbReleasedListener);
    lightbulbGrab=2;
    }
}

function lightbulbReleasedListener(event:Event):void {
    if(lightbulbGrab==3){
    releaseLightbulb();
    }
}

function releaseLightbulb() {
    lightbulbMove.stopDrag();
    lightbulbMove.visible=false;
    cursor_mc.visible=true;
    cursor_mc.startDrag(true);
    lightbulbGrab=0;
    trace("Lightbulb grab is reset (stage check) | "+lightbulbGrab);
    stage.removeEventListener(Event.ENTER_FRAME, lightbulbReleasedListener);
    stage.addEventListener(Event.ENTER_FRAME, lightbulbMoveListener);
}
// hittest lightbulb and light;
stage.addEventListener(Event.ENTER_FRAME, lightbulbHitLampListener);
function lightbulbHitLampListener(event:Event):void {
    if (lightbulbMove.hitTestObject(tableView.tableViewLamp)) {
        lightbulbInserted=true;
        if (lightbulbInserted) {
            tableView.tableViewLamp.gotoAndStop(2);
            trace("Lightbulb grab is released and inserted (stage check) | "+lightbulbGrab);
            lightbulbGrab=3;
            stage.removeEventListener(Event.ENTER_FRAME, lightbulbHitLampListener);
        }
    }
}

The code above would use the EventListeners to look out for when specific user tasks have been completed. To do this I used if statements on integers

The integers numbers represented the following:

0 - default
1 - grabbed
2 - released
3 - dropped

The reason why default is so important is because it has not yet been grabbed, and it means that if the lightbulb was released onto the stage but not directly on the lamp, it would appear back in the default position - in the inventory.

The user event tasks were scripted in the inventory.

The reason for doing this is because I would not know which of the inventory slots the lightbulb was in. So I would therefore do it on the frame of the inventory movieclip that the item is in.

I used the following code inside in the inventory:

lightbulbInv.addEventListener(MouseEvent.MOUSE_DOWN, grabbedLightbulbListener);
function grabbedLightbulbListener(evt:MouseEvent):void {
    if (MovieClip(root).lightbulbGrab==0) {
        trace("this should work at 0 only");
        MovieClip(root).lightbulbGrab=1;
        trace("lightbulb grab is grabbed (inventory check) | "+MovieClip(root).lightbulbGrab);
        lightbulbInv.visible=false;
    }
}
stage.addEventListener(MouseEvent.MOUSE_UP, notgrabbedLightbulbListener);
function notgrabbedLightbulbListener(evt:MouseEvent):void {
    lightbulbInv.visible=true;
    if(MovieClip(root).lightbulbGrab==2){
        trace("Lightbulb grab is released (inventory check) | "+MovieClip(root).lightbulbGrab);
        MovieClip(root).lightbulbGrab=3;
        trace("Lightbulb grab is dropped (inventory check) | "+MovieClip(root).lightbulbGrab);
        //lightbulbInv.visible=false;
        lightbulbInv.addEventListener(MouseEvent.MOUSE_DOWN, grabbedLightbulbListener);
    }
}

stage.addEventListener(Event.ENTER_FRAME, lightbulbUsedListener);
function lightbulbUsedListener (event:Event):void{
    if(MovieClip(root).lightbulbInserted){
        stage.removeEventListener(MouseEvent.MOUSE_UP, notgrabbedLightbulbListener);
        gotoAndStop("itemNothing");
    }
}


Both of these codes have so far been the hardest to write in this project.

I found this on  drag and drop of items
http://www.actionscript.org/forums/showthread.php3?t=151862