i've done a search on this subject and its been posted a million times but i think i'm even more confused!!
basically i'm new to flash and i'm making a simple game, i've created about 6 different scenes (not sure if that the best way to go about it) and in each scene are items (mc's) i need to collect (keys for doors, etc).
i need some kind of inventory that keeps the stuff in throughout the game and obviously the items disappear from scene when collected and dissappear from inventory when used.
thanks fo getting back to me on this but i'm not having much luck. i've just started using flash and maybe i've bit off more than i can chew but i really want to finish this now.
is there any chance you could explain this as if you were talking to an idiot?
or point me to tutorial of some kind, i've spent about 4 hours going through old posts and i've got nowhere!
Another thing you might consider would be to have it use a # to tell if you have it or not, for instance, in this frame you are getting the object:
on (enterFrame){
var swordisgotten = 1;
}
and this would be the frame for the inventory
on (enterFrame){
if(swordisgotten == 1){
inventory1_mc.attachMovie(sword_mc, sword, 1);
}
}
And that would load the sword movie clip into the movie clip representing the first inventory space. Simply set the var back to 0 and it won't load into the inventory. The same concept could be used for wether or not it played in the frame. It's really confusing to work with in big games but it works. If you do it in a different scene you'd need to make the variable _global so that it wouldn't make a new variable every scene. That's documented in the actionscript dictionary in the help.
say if i have two scenes, in scene 1 i have 2 objects, one called key_mc and one called inventory_mc, and in scene 2 i have 2 objects, one called door_mc and one called inventory_mc.
all i want to do is to be able to drag the key_mc onto the inventory_mc then go to scene 2 where the key will still be visible and i can drag the key onto the door.
is there anyway anyone could run through it in the most simple way, i really i'm a complete novice and i'm finding this scripting lark most difficult.
PS. This game is due to be released in shops in August. RRP £39.99
yeah cheers adam, the actionscript seems fairly simple, i might be able to get my head round it.
just one question, where did you put the script on the key_btn?? i can't seem to find it.
i know i'm been really stupid here but i've opened up the key, opened the key button... where's the script? i see the up over down hit stages, but nothing in actions??
You don't actually want to go into the key button,...right click on the key movie clip in the library, click edit, then click once on the key in there to make sure it's selected, and then open your actionscript window...
hello again, i think i've nearly cracked this. what i've done is create two mc's of each object(one in inventory, one on scene) and make the inventory object invisible.
i've set global variables...
_global.key="0"
_global.potion="0"
and if statements...
if(_global.key=="1"){
key_mc._visible=false;
key1_mc._visible=true;
but.. when i go through the different movies the inventory is correct unless i return to a previous movie and the variable is reset and the object disappears.
as you can see the objects stay in the inventory until you return to the scene where they were picked up, because i'm declaring the variable as "0" again so it disappears.