5 Replies Latest reply on Jul 6, 2007 3:14 PM by kglad

    Need help with a few things

    Shad0wdrag0n Level 1
      I need some help with a few things for some flash games I'm working on. I'm not even sure if the things I need help with are possible to do in flash. If they are I'd really like some help figuring out how to do them. The first thing I need help with is creating an rpg style inventory. What I have at the moment is an MC that's the inventory. It sits off-stage until you click on a button, which moves it on-stage. Clicking another button moves the inventory MC back off-stage. What I can't figure out is how to make it so items the player picks up are removed from the stage and added to a slot in the inventory MC. I would like to find a way that makes it so when an item is used it is removed from the inventory and the other items reshuffle so there are no empty slots. For example: say I have 4 slots with items: slot 1 = item A, slot 2 = item B, slot 3 = item C, and slot 4 = item D. If item B is used and removed from the inventory, I want it so items C and D move to slots 2 and 3. If the player picks up another item I want it so that it's added to slot 4.

      The other thing I need help with is moving from .swf file to a different .swf file. Say my game has an Inn as the starting point. From the Inn the player can go on quests. I don't want to put everything into one big .swf file. Instead, I'd like to have the Inn and each quest as a seperate .swf file. When the player clicks on something in the Inn it loads the correct quest .swf. I'd also like it so that variables are moved from one .swf to another. So if the player loses some health, gains some gold, and picks up a few tiems, those changes will carry over to the Inn when the quest finishes. Also, changes made in the Inn need to carry over into the quests. Is this possible to do?

      Any help I can get with these things would be greatly appreciated. If there are any tutorials that would help me please let me know where I can find them. Thanks.
        • 1. Re: Need help with a few things
          kglad Adobe Community Professional & MVP
          yes, it's all possible with flash.

          1. your items should be library movieclips that can be attached to the stage when needed, removed when needed and then attached to the inventory movieclip when needed. you'll need to learn how to use the attachMovie() method of movieclips.

          2. check the loadMovie() or perhaps better for you, loadMovieNum() methods of movieclips.
          • 2. Need help with a few things
            Shad0wdrag0n Level 1
            OK, I've got the loadMovieNum thing working pretty good. I've also learned how to use attachMovie. But, I can't seem to figure out how to get the attached movies to automatically arrange themselves. I don't want to give each item a set coordinate within the inventory. What I want is to make it so that when an item is picked up it automatically goes into the first available inventory slot. I also want to make it so that if an item is removed from the inventory the remaining items get re-sorted so there are no gaps. Is such a thing possible to do, and if so how? Is there a way to get a movie clip to automatically arrange the movie clips within itself? Sorry if all this is confusing, but this isn't the easiest problem to describe.
            • 3. Re: Need help with a few things
              kglad Adobe Community Professional & MVP
              you should be able to use the number of items in your inventory to determine the position for a newly added item. and when an item is removed you should be able to iterate through all inventory items (or just the items with index greater than the removed item if you use an array to store inventory items) and position them.
              • 4. Re: Need help with a few things
                Shad0wdrag0n Level 1
                Are there any online tutorials that will teach me how to do those things? I'm fairly new to Flash and there's a lot about Action Script I still need to learn.
                • 5. Re: Need help with a few things
                  kglad Adobe Community Professional & MVP
                  searching via google is the best bet for finding tutorials.