AS2 Upgrade Shop

5 posts

Flag Post

things I want to do:
-Clicking on a upgrade will show your current equip with his stats and the selected one with his stats.
-The “Buy” button will only appear if your money is higher than the selected equip price.
-If you sell your current equip you’ll receive money and automatically wear(if you have any left) other equip in that category.
-Character stats must show the base stats + equips stats(I’ll put stuff like “attack” and “defense”)

Thanks in advance, if you dont know how to do this please atleast give a idea.
sorry for the bad english.

 
Flag Post

I am not a web developer so I have no idea whatsoever as to how to do it in as2, but here’s an idea; Look up info on as2, and try to do it yourself, once that is done and you get some stuff working you can come back to this, show us your code and people will be able to help, however nice people may be on these forums they will not write your whole game for you, they will help you debug your own things but only if you show that you are interested in trying to learn.

 
Flag Post

well, so far I have this:
////////////////////////////////////////////////////////////////////////////////////////////////
Money = 50;
BaseHealth = 30;
BaseMagic = 15;
BaseAttack = 10;
BaseDefense = 5;
EquipHealth = 0;
EquipMagic = 0;
EquipAttack = 0;
EquipDefense = 0;
Health = (BaseHealth+EquipHealth);
Magic = (BaseMagic+EquipMagic);
Attack = (BaseAttack+EquipAttack);
Defense = (BaseDefense+EquipDefense);
function Stats() {
HP = "HP: "+Health;
MP = "MP: "+Magic;
ATT = "ATT: "+Attack;
DEF = "DEF: "+Defense;
Cash = "Cash: “Money”$";
}
function GetMoney() {
if (Money<1000) {
Money++;
}
if (Money>=1000) {
Money = 999;
}
}
function onEnterFrame() {
Stats();
this.GetMore.onPress = function() {
GetMoney();
};
}
///////////////////////////////////////////////////////////////////////////////////////////////////

The script puts the stats on the screen. But I still have to solve the points 1,2 and 3
Also, can someone put a good site to learn about arrays?

 
Flag Post

Game development is all about using variables. Use an if statement to find out if something is bigger or smaller than something else, and use functions to add or subtract from values like money or stats.

 
Flag Post

Just google ‘[AS component] as2 language reference’, and you will most likely find it . About arrays, you can put an array inside another array:

var myArray = new Array()
myArray[0] = new Array("health", "banana")
myArray[1] = new Array(128, 256, 0.556)

You want to use this for your upgrades: have one array for all upgrades, with 4 arrays in it for you 4 different upgrades (wep, top, etc.), inside those, put the 6 different levels, and finally, inside those, put their values (cost, bonus).

> upgrades
>> wep
>>> level1
>>>>cost
>>>>bonus health
>>>>bonus magic
and so on…
>>>level2
and so on…
>>top
>>>level1
and so on…

The technical term is: ‘arrayception’

Selling upgrades is not a good idea for a game, unless you make the selling price much lower than the buying price