lil boi blue
Member
|
nope, it workslike a charm, you must have done something wrong, i'll change it a bit my changes are in blue __________________________________________________________ RPG Inventory This tutorial covers making item slots for a walkaround RPG. 1) left click on the first frame and Add this script to it (open up actionscript tab at bottom of screen) ---> 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++; } } 2) On the stage draw two items that you want to be the items that can be picked up, make them movie clips and give them the following script ----> onClipEvent (enterFrame) { if (_root.character.hitTest (this)) { _root.addToslot (this); } } (character = The name of your character, so it can be changed depending on what you call it) 3) Draw what you want to be your character, make it a movie clip with the name character and give it the following script. Also in properties tab on bottom in the instance box, name your character........'character' nothing else. then give your character this actionscript ----> onClipEvent (load) { moveSpeed = 19; } onClipEvent (enterFrame) { if (Key.isDown (Key.RIGHT)) { this._x += moveSpeed; } else if (Key.isDown (Key.UP)) { this._y -= moveSpeed; } else if (Key.isDown (Key.DOWN)) { this._y += moveSpeed; } else if (Key.isDown (Key.LEFT)) { this._x -= moveSpeed; } } (This is a very very basic script but you can change the speed by altering the number in red) 4) Now draw your item 'holders' ,they could be rectangles (with no fills works best) and make them movie clips. If you hade 1 item that could be picked up only make one box but if you have two items that could be picked up make two boxes and so forth.. Now give the box(s) the names itemSlot1 changing the number for every box eg: itemSlot1, itemSlot2 ---> Dont forget to right itemSlot like this ---> itemSlot 5)And now your done! EXTRA---> Arrow keys to move and 'walk over' items to 'collect' (if you pick up 'axe' first it will go into item slot 1 but if you pick up 'sword' first it will go into item slot 1, there are no set slots for items) EG= http://haze.voodoolabs.net/inventory.swf
< Message edited by lil boi blue -- 10/30/2005 17:41:41 >
|