Sunday, 23 March 2014

Working Process: Creating the Prototype - Scripting Inventory

Before I create any of the art work for the game, it's important to get the prototype done first involving the main scripting.

The main scripting would involve the inventory as it is one of the most important parts of an Room Escape game.

Currently, I have 10 inventory slots. Each inventory slot is set to a boolean of false. When an item is clicked on, an if statement would be applied.

Here is the if statement I made:

function ifFullPassSquare():void {
    if(!inv1Full){
        inv1.gotoAndStop(2);
        inv1Full = true;
    } else if (inv1Full){
        inv2.gotoAndStop(2);
        inv2Full = true;
    }
}

This states that if the first inventory slot is not full, fill it. If it is full, try the next slot.

With this code this means that the items can be picked up in any order and would also appear in the inventory in the order you pick it up in.

 Here's a link to the prototype

No comments:

Post a Comment

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