Skip to main content
May 31, 2007
Question

Need help with a few things

  • May 31, 2007
  • 5 replies
  • 387 views
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.
This topic has been closed for replies.

5 replies

kglad
Community Expert
Community Expert
July 6, 2007
searching via google is the best bet for finding tutorials.
July 6, 2007
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.
kglad
Community Expert
Community Expert
July 6, 2007
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.
July 6, 2007
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.
kglad
Community Expert
Community Expert
May 31, 2007
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.