| 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


No comments:
Post a Comment
Note: only a member of this blog may post a comment.