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.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.