Sunday, 20 April 2014

Working Processes: Finalising the Game - Incorrect password, fixing can duplication and other issues

Today, the first thing I did was fix the password displayed on the notebook. The C was too close to the 4 making the 4 look like an A. This is an issue as it could make the user type in the wrong code.

To fix this issue, instead of adding a space between the C and the 4 I instead modified the letter spacing in the character properties panel.

Before



After



 To fix the can glitch, as found in the user testing. I created a boolean called drugCan found and set it to true once the item was picked up.

I then made the following if statement and inserted into the actions layer of the viewVendingDispenser frame:

if (drugCanFound){
    vendingDispenserView.itemDrugCan_btn.visible=false;
}

I noticed that users would not need to log into the computer and insert the lightbulb in order to complete the game. Of course to do this, the user would need to know (or at least guess) which code from the notebook to use and they would have needed to know the computer's password from playing the game before.

In order to make it so that the user would have to do every option before escaping. I created a boolean which when set to false made it so that you could not enter the vending machine code and was set to true once you log into the computer. This way, the user would have to log into the computer, in turn making the boolean true, allowing the user to use the vending machine.

To solve the issue of why they would need to log into the computer before typing the code in, I will later narrate something along the lines of "I don't know what I'm looking for so I'd better leave this for now".

As for the notebook, I have now introduced the same system I implemented for the desk note. The user must turn on the lamp first otherwise there will not be enough light to read it.

Before for the notebook, all that was required was glasses to be put on so that it wasn't blurry.

To do this I used the following code

tableView.tableViewNote_btn.addEventListener(MouseEvent.CLICK,tableViewNoteListener);
function tableViewNoteListener(ev:MouseEvent):void {
    if (lightbulbFound && inventorySystem.indexOf("itemLightbulb")==-1) {
        if (! glassesOn) {
            desknoteZoom.visible=true;
            desknoteZoom.gotoAndStop(2);
        } else if (glassesOn) {
            desknoteZoom.visible=true;
            desknoteZoom.gotoAndStop(1);
        }
    }
    else{
        textAppear.textBoxAnim.item_txt.text="NOT ENOUGH LIGHT TO READ";
        textAppear.gotoAndPlay(1);
    }
}

Due to the format of the code, the blurriness of the note would not affect the note unless the lamp is on. Which is ideal as the user would not have access to the note without the lamp being on.

Saturday, 19 April 2014

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

Today, when doing the user testing. The user found a glitch which allowed the drug cans to be duplicated.

Below is a printscreen from the game with the cans duplicated and cut.


The glitch would occur when the user left the vending machine dispenser and came back.

To fix this glitch a boolean will need to be created and set to true once the can has been collected. An if statement will be added so that the can will only appear if the boolean is set to false.

The user also pointed out that the 4 looks like an A due to the C. This is the second time a user has pointed out this issue, so I will fix it straight away as well as fixing the can duplication glitch.

It took this user 7 minutes to complete the game, which is the fastest time so far.



Working Processes / Planning: Finalising the Game - Cutting can, Scripting fuse box, door animation, timer, updating the graphics of viewTable

Today, I finished creating the game. All the main scripting has been complete and is fully functional in regards to completing the game. As far as I'm aware, there are also no more glitches or errors within the code.

As for adding narration to the piece, I am unsure as to whether this would go well with the artefact or whether it will take it away from the user experiecing how to Escape the Room themselves.

Perhaps, the narration would be just used in the cutscene instead and not throughout the game.

I will find out the best route to take with this from my tutorial with Daniel, coming up on the 3rd of April.

 To getting to this stage of the production processes I had to complete the following things.

I had to script it so that the user was able to cut the cut into half


I made it so that when you click on the can, it pops like, like the notebook or desk note would have. This way, the user can read the contents of the can. I then added a button for the user to click to cut the can. Upon clicking the button, the can would be removed from the inventory and the cut can would be added.

If the user is not wearing their glasses, the ability to cut the can will not be accessible and therefore have a 50% with the event listener removed. Once the user wears their glasses, the contents of the can will be unblurred allowing the user to not only read the can but now cut it too.

I feel that this is important so that the user is aware of the content on the can.

Since the user must wear the glasses to read the notebook or note, it is unlikely the user will be able to get this far in the game without wearing the glasses in the first place. This script was added more so for users who are coming back to beat their score.

I then had to create the script for the fuse box. This was a simple hit test for the cut can and the fuse box. When adding this script, I had to make sure that the script would not work if the fuse box doors were close. In order to do this, I made sure that the script didn't work on frame 1 of the fuse box MC.

My script was the following:

// ---------Hit test item---------
// hittest cut can and fusebox;
stage.addEventListener(Event.ENTER_FRAME, canCutHitFuseBoxListener);
function canCutHitFuseBoxListener(event:Event):void {
    if (drugCanFound) {
        if (canCutMove.hitTestObject(shelfBoxView.insertCanHittest)) {
            if (stage.contains(canCutMove)&&shelfBoxView.currentFrame==1) {
                trace("yes, child (canCutMove) is there and going to be removed");
                removeChild(canCutMove);
                canCutGrab=3;
            } else {
                //lightbulbInserted=true;
                inventorySystem.splice(inventorySystem.indexOf("itemCanCut"),1);
                ifFullPassItem();
                //if (lightbulbInserted) {
                trace("Cut Can grab is released and inserted (stage check) | "+canCutGrab);
                canCutGrab=3;
                doorUnlocked=true;
                trace("Door Unlocked = "+doorUnlocked);
                overlayTint.visible=false;
                shelfBoxView.gotoAndStop(3);
                stage.removeEventListener(Event.ENTER_FRAME, canCutHitFuseBoxListener);
            }
        }
    }
}


This script also made it so that if the cut can was to be dragged whilst the fuse box doors were close (on frame 1 of the MC), that the child would be removed before opening the doors. This way, the hittests of the cut can dragged onto the stage (before the door was opened), would not interfere with the acitivated hittest when the doors were opened.

Afterwards, I created the boolean doorUnlocked.

This way I could make it so that the door will unlock as soon as the cut can has been dragged onto the fuse box.
The lights will also turn on when this happens, to do this, the movieclip overTint has been set to false.

I then went to the door camera angle and animated is so that when the doorUnlocked boolean is set to true, the screen turns black and takes you to the completed game label.

Once here, I added a timer.

In a tutorial with Dan, we discussed it would be a bad idea to add a timer which would be visible throughout playing the game as it would make the user play the game differently. By having it so that the time is displayed at the end of the game, it makes the users more relaxed on their first play through as they don't realise it is there and are able to play the game properly.

To create this timer, I used the timer from the "Code Snippits" from the windows toolbar. Here various codes were accessible including a timer. This timer however only worked in seconds.

The code was the following:

/* Simple Timer
Displays a countdown timer in the Output panel until 30 seconds elapse.
This code is a good place to start for creating timers for your own purposes.

Instructions:
1. To change the number of seconds in the timer, change the value 30 in the first line below to the number of seconds you want.
*/

var fl_TimerInstance_2:Timer = new Timer(1000, 30);
fl_TimerInstance_2.addEventListener(TimerEvent.TIMER, fl_TimerHandler_2);
fl_TimerInstance_2.start();

var fl_SecondsElapsed_2:Number = 1;

function fl_TimerHandler_2(event:TimerEvent):void
{
    trace("Seconds elapsed: " + fl_SecondsElapsed_2);
    fl_SecondsElapsed_2++;
}


I read the code and figured out how it worked, I then managed to come up with an idea on how I could involve minutes too. The code changed to the following:

var fl_TimerInstance:Timer = new Timer(1000, 3000);
fl_TimerInstance.addEventListener(TimerEvent.TIMER, fl_TimerHandler);

var fl_SecondsElapsed:Number = 1;
var fl_MinutesElapsed:Number = 0;

function fl_TimerHandler(event:TimerEvent):void
{
    if(fl_SecondsElapsed == 60){
        fl_SecondsElapsed = 0;
        fl_MinutesElapsed++;
    }
    trace(+fl_MinutesElapsed + " Minutes and " + fl_SecondsElapsed +" Seconds");
    fl_SecondsElapsed++;
}


So when fl_SecondsElapsed == 60, I would reset it to 0 and add 1 to the minutes.

This worked very well and was ideal.

Finally, I then went back to the viewTable and completed the art for that camera angle. Originally I had not done this as I felt that the scripting of the game was more important than the appearance.

Before


After


Once complete, I was very happy with the results.

Friday, 18 April 2014

Working Processes / Planning: Creating the Game - New idea, Google Sketchup, take and move new items.

I have a new idea!

So far I haven't had an idea on how the user will actually escape from the room.

However, I know that cans from vending machines are aluminum, and these are a good conductor of electricity. I can change the picture frame near the shelf, which currently has no use, into a fuse box. Inside the fusebox, two parts will be disconnected and one part would still be connected. The disconnected parts would be for the Door and Lights whilst the still connected part would be there for the rest of the electricity.

There is also nothing on the shelf there, so I could add scissors there which could be used to cut the can.

The first thing I need to do, is to open my Google Sketchup document.

Using the components list from the materials menu I added scissors and placed them on top of the shelf.

I could not find a suitable fuse box. I searched for an alternative name - distribution board and found one which looked nice.
This fuse box had door panels, however they weren't split into different groups, this meant that the doors could not be opened.
I decided to keep the door panels, but delete the box behind. Then group each door panel individually and redraw the box behind. There were now three groups of components to make the fuse box instead of just one. This meant that I could now rotate the doors how I wanted.

I took printscreens of the fuse box with the doors open and closed and imported them into Flash.


 I traced around the first image and added the doors to a new layer. In the next frame, I deleted the doors from the layer and drew them again but open. As I did not have any content inside this fuse box, I drew them straight into Flash on a separate layer, with some wires unconnected.


As there was a shelf to the left of the fuse box, it meant that the contents of this camera angle was wider than normal. I could have scaled both of them down, to create a zoomed out effect, but I wanted the contents to be close enough, even if it meant that a door had to be cut off the stage in the process.

I then made it so the scissors could be taken from the shelf and added to the inventory and applied a drag an drop function, which I used with the lightbulb, to both the scissors and the can. I adjusted the code accordingly so it would work with these items too.

Thursday, 17 April 2014

Working Processes: Creating the Game - Adding to the Vending Machine, sorting password on note

I added more to the vending machine script so that now after the item code had been entered correctly, the vending machine would dispense the Amnezol drug.

The following script was used:

// ---------Check what to do next---------
receiptBooleanCheck()
function receiptBooleanCheck():void {
    if (! receiptInserted) {
        vendingFriendlyText.text="PLEASE INSERT RECIEPT";
    } else if (receiptInserted && vendingMachine_txt.text!="AC42G") {
        vendingFriendlyText.text="PLEASE ENTER YOUR CODE";
        stage.addEventListener(Event.ENTER_FRAME, vendingTextCountListener);
        stage.addEventListener(Event.ENTER_FRAME, vendingTextCountReset);
    } else if (receiptInserted && vendingMachine_txt.text=="AC42G"){
        vendingFriendlyText.text="DRUG READY TO COLLECT";
        orderedDrug = true;
    }
}

By adding this script and setting a boolean to true, this means that I can add an if statement so that once the boolean is set to true, the drug can would appear.

I created a new frame, and gave it the lable of "viewVendingDispenser". I then drew in the art for the bottom of the vending machine and created the can.

I used the following code for this frame:

if (orderedDrug) {
    vendingDispenserView.itemDrugCan_btn.visible=true;
}

I then fix the issue regarding the password, as noted from the user testing, placed on the note.

Before

After



This looked much better and now contained a password which could be used to log into the computer.

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

Today, I had the game tested again.
Since I had created more content for the game since the last time, there were now other features to be evaluated.

They were the following:

Feedback Type Solve it by Importance
esc go back Feature Adding it Extremely
click outside to close Feature Adding it Very
4 looks like A in notebook Art Separating the C from the 4 Moderate
M in password looks like W Art Breaking the font and adjusting the appearance of the lower case M manually Very
C is R - Wrong Password Art Changing the letter to the correct one Extremely
back wasn't clear Feature Adding notification to let you know it's there Moderate

The reason that each letter issue with the Art has a different importance level is due to the following reasons:

Users are likely to be able to figure out that the 4 is actually a 4 and not an A. Very few users had issues wit the 4 looking like an A and knew the C was placed before it.

The M in the password did look like a W, but still looked more like an M. 

The wrong letter was given at the end of the password meaning that it would be nearly impossible to log into the computer. This is extremely important to fix otherwise it would be completable.


It also took the user 12 minutes to complete the uncompleted gam.

Wednesday, 16 April 2014

Working Processes: Creating the Game - Reading the Note, Vending Machine Code and Splice Issues

Today, I made it so that the note [on the table] can be read, if you have the lightbulb inserted and are wearing your glasses (otherwise the text is blurred).

I have also introduced the ability to add the order code, found from the notebook, into the vending machine. Since adding the order code to the vending machine was through buttons on the vending machine, this meant that I would have to convert each button into a movieclip. To avoid doing this I created a invisible symbol and place it on top of each button. This way, I didn't need to create a new symbol for each button. The symbols could be copied and pasted, and thus reused with different instance names.

I created the following code for the buttons.

// ---------Characters on 5 - Remove buttons ---------
function vendingTextCountListener(event:Event) {
    if (vendingMachine_txt.text.length>=5) {
        trace("No Room Left");
        removeVBtnListeners();
        receiptBooleanCheck();
        stage.removeEventListener(Event.ENTER_FRAME, vendingTextCountListener);
    }
}
// ---------Characters on 0 - Add buttons ---------
function vendingTextCountReset(event:Event) {
    if (vendingMachine_txt.text.length==0) {
        trace("Characters Reset | Room to type");
        addVBtnListeners();
        stage.removeEventListener(Event.ENTER_FRAME, vendingTextCountReset);
    }
}
// ---------Start Again---------
VbtnCANCEL.addEventListener(MouseEvent.CLICK,vBtnCancel);
function vBtnCancel(ev:MouseEvent):void {
    vendingMachine_txt.text=("");
    stage.addEventListener(Event.ENTER_FRAME, vendingTextCountReset);
    stage.addEventListener(Event.ENTER_FRAME, vendingTextCountListener);
}
// ---------Add / Remove functions---------
function addVBtnListeners():void {
    VbtnA.addEventListener(MouseEvent.CLICK,vBtnAListener);
    VbtnB.addEventListener(MouseEvent.CLICK,vBtnBListener);
    VbtnC.addEventListener(MouseEvent.CLICK,vBtnCListener);
    VbtnD.addEventListener(MouseEvent.CLICK,vBtnDListener);
    VbtnE.addEventListener(MouseEvent.CLICK,vBtnEListener);
    VbtnF.addEventListener(MouseEvent.CLICK,vBtnFListener);
    VbtnG.addEventListener(MouseEvent.CLICK,vBtnGListener);
    VbtnH.addEventListener(MouseEvent.CLICK,vBtnHListener);
    VbtnI.addEventListener(MouseEvent.CLICK,vBtnIListener);
    Vbtn1.addEventListener(MouseEvent.CLICK,vBtn1Listener);
    Vbtn2.addEventListener(MouseEvent.CLICK,vBtn2Listener);
    Vbtn3.addEventListener(MouseEvent.CLICK,vBtn3Listener);
    Vbtn4.addEventListener(MouseEvent.CLICK,vBtn4Listener);
    Vbtn5.addEventListener(MouseEvent.CLICK,vBtn5Listener);
    Vbtn6.addEventListener(MouseEvent.CLICK,vBtn6Listener);
    Vbtn7.addEventListener(MouseEvent.CLICK,vBtn7Listener);
    Vbtn8.addEventListener(MouseEvent.CLICK,vBtn8Listener);
    Vbtn9.addEventListener(MouseEvent.CLICK,vBtn9Listener);
    Vbtn0.addEventListener(MouseEvent.CLICK,vBtn0Listener);
    VbtnS.addEventListener(MouseEvent.CLICK,vBtnSListener);
}
function removeVBtnListeners():void {
    VbtnA.removeEventListener(MouseEvent.CLICK,vBtnAListener);
    VbtnB.removeEventListener(MouseEvent.CLICK,vBtnBListener);
    VbtnC.removeEventListener(MouseEvent.CLICK,vBtnCListener);
    VbtnD.removeEventListener(MouseEvent.CLICK,vBtnDListener);
    VbtnE.removeEventListener(MouseEvent.CLICK,vBtnEListener);
    VbtnF.removeEventListener(MouseEvent.CLICK,vBtnFListener);
    VbtnG.removeEventListener(MouseEvent.CLICK,vBtnGListener);
    VbtnH.removeEventListener(MouseEvent.CLICK,vBtnHListener);
    VbtnI.removeEventListener(MouseEvent.CLICK,vBtnIListener);
    Vbtn1.removeEventListener(MouseEvent.CLICK,vBtn1Listener);
    Vbtn2.removeEventListener(MouseEvent.CLICK,vBtn2Listener);
    Vbtn3.removeEventListener(MouseEvent.CLICK,vBtn3Listener);
    Vbtn4.removeEventListener(MouseEvent.CLICK,vBtn4Listener);
    Vbtn5.removeEventListener(MouseEvent.CLICK,vBtn5Listener);
    Vbtn6.removeEventListener(MouseEvent.CLICK,vBtn6Listener);
    Vbtn7.removeEventListener(MouseEvent.CLICK,vBtn7Listener);
    Vbtn8.removeEventListener(MouseEvent.CLICK,vBtn8Listener);
    Vbtn9.removeEventListener(MouseEvent.CLICK,vBtn9Listener);
    Vbtn0.removeEventListener(MouseEvent.CLICK,vBtn0Listener);
    VbtnS.removeEventListener(MouseEvent.CLICK,vBtnSListener);
}
// ---------The button functions---------
function vBtnAListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"A");
}
function vBtnBListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"B");
}
function vBtnCListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"C");
}
function vBtnDListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"D");
}
function vBtnEListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"E");
}
function vBtnFListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"F");
}
function vBtnGListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"G");
}
function vBtnHListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"H");
}
function vBtnIListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"I");
}
function vBtn1Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"1");
}
function vBtn2Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"2");
}
function vBtn3Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"3");
}
function vBtn4Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"4");
}
function vBtn5Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"5");
}
function vBtn6Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"6");
}
function vBtn7Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"7");
}
function vBtn8Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"8");
}
function vBtn9Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"9");
}
function vBtn0Listener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"0");
}
function vBtnSListener(ev:MouseEvent):void {
    vendingMachine_txt.text=(vendingMachine_txt.text+"*");
}

I scripted this so not only would the user be able to to use each number and letter of the vending machine, but also so that if they had gone over 5 characters, the eventlistener would be removed so they weren't able to continue.
The cancel feature (the red c), was made so that users would be able to delete the characters they typed in if they wanted to start again.


The entering of the buttons were applied to a new frame, so that the user had to zoom into the buttons before proceeding.

There were also issues with the Splice feature which I needed to address.

When testing the game myself, each time I had plugged in the lightbulb and went to view the drawers to collect the key, upon pressing the back button - they key would automatically be removed from my inventory. This created a lot of confusion as I didn't know why this was the case, since to my knowledge, the code was flawless.

What I had not realised is that the splice feature will remove the last item added to the vector if it cannot locate the item referred to in the script.

So since the lightbulb had already been removed [from inserting it into the lamp], when going back to that frame, it removed the key.

The splice feature was only suppose to be active if the lightbulb had an if(hitTestObject) with the lamp.

What had happened was that instead of me scripting it so that it would remove the child, I instead made it invisible - so that it would disppear. Meaning that once the light was inserted, it was still there on top of the lamp. Thus meaning the splice was always active.

To fix this I added a removeChild after the lightbulb had (hitTestObject with the lamp.