0

作成中のゲームで配列を使用してインベントリを作成しようとしています。

私が必要としているのは、次のような数値と変数を組み合わせる方法です。

itemBoxNumber = "itemBox" + currentItemBox;
//In this case itemBoxNumber would say itemBox1

itemBox1 を置き換えるために使用できます。

 function itemsMenuUpdate():void
    {
    for (var a:int = 0; a<maxInventory; a++){
                var currentItemBox:Number = 1;
                if(~inventory.indexOf("Potion")){
                mainMenu.itemBox1.gotoAndStop("Potion");
            }
            if(~inventory.indexOf("Hi-Potion")){
                mainMenu.itemBox1.gotoAndStop("Hi-Potion");
            }
        }
    }

AS2の作業方法しか見つかりません。これでどんな助けでも大歓迎です。

4

3 に答える 3