somebody621 -> RE: Flash Q&A thread 2 ** checked everyday (3/20/2006 18:05:38)
|
lil boi blue:try not to put as many onClipEvents, expecially onEnterFrame. Also, don't manipulate the x. Just use startDrag. When the mouse is up and the thing touching the thing you want to hit,do the drag and drop snap thing and set the x. Althorne:Ammo counter:make a dynamic text box. Either give it a variable name as ammo, or set an instance name and put "ammocounter.text=ammo;"when you shoot. When you reload, just change the ammo to the default ammo. For the money:make a object's money like char.money=500; and enemy1.money=500; or something like that. Also make a function loseMoney like this:function loseMoney(moneylost, currentmoney, attacker, shot){ Under that put this:
if(currentmoney>moneylost){
money -= moneylost;
attacker.money+=moneylost;
}else{
shot.money = 0;
attacker.money+=currentmoney;
}
}
When anybody gets shot, put this code:
//replace variables as needed
loseMoney(50, char.money, enemy1, char); basicly, you just set up a user defined function. Thing of it as your new function as being like gotoAndStop, and (50, char.money, enemy1, char) as being the frame you want to go to. Buying stuff is similar to the code except you add the stuff to your inventory or something and there'd be no else. Hope this helps! I rarely give out actual code. flsg:you posted the question somewhere.
|
|
|
|