So I am making a point and click game and my inventory system wont work. I basically used the same technique that a tutorial showed me on NG.
empty = 0;
t=0;
i=0;
_root.inventory = [_root.slotA];
for(i=0;i<4;i++){
_root.inventory[i] == 0;
}
if (_root.inventory[i] ==0){
_root.inventory[i].gotoAndStop(1);
}
gun.onRelease = function(){
_root.gun.unloadMovie();
while(t<5 && empty == 0){
if (_root.inventory[t] == 0){
_root.inventory[t].gotoAndStop(2);
_root.inventory[t] == 1;
empty = 1;
}else{
t ++;
}
}
}
What I tried to do:
Make every inventory slot == 0;
If a slot is equal to 0, then it would stop on an empty frame
Then after clicking the gun:
Search through each slot, if one of them was equal to 0 (on the empty frame)
that slot would go to frame 2 (picture of a gun)
Then, because empty = false, the search would stop.
After fiddling around with the code I noticed whenever I put in an IF statement the code wouldn't work. There was no issue with the arrays or anything (I tested the code using arrays and no IF statement and it worked.)
Can anyone help me?