abstract:
onClipEvent (enterFrame) {
if (_root.player.hitTest (this)) {
_root.addToslot (this);
}
}
("player" is the user)
It works, I've tested it, but only when it is out of the movieclip. Can anyone tell me how to make this work inside the movieclip?
Thanks in advance
Hi, I made an inventory and it works, the problem is that I need it to be inside a movieclip (menu) but it won't work. Here's how I made it:
I made movieclips that are squares with no fill and gave the instance "itemSlot" + number (I made 16). Then I added this code to the main actions frame:
Code:- currentslotnum = 1;
- stop ();
- function addToslot (item) {
- if (!item.found) {
- item._x = eval ("itemSlot" + currentslotnum)._x;
- item._y = eval ("itemSlot" + currentslotnum)._y;
- item.found = true;
- currentslotnum++;
- }
- }
Copy Code And items are movieclips smaller than the slots with instance "item" + number with this code:
Code:- onClipEvent (enterFrame) {
- if (_root.player.hitTest (this)) {
- _root.addToslot (this);
- }
- }
Copy Code ("player" is the user)
It works, I've tested it, but only when it is out of the movieclip. Can anyone tell me how to make this work inside the movieclip?
Thanks in advance |