You will need a var that will keep track of the total price, and then you add or subtract from that var to have a correct total as you add or remove items from display. So

if(mouse_left){
{
unit = ent_create(f[my.skill2],my.x,act);
vec_set(unit.pan,my.pan);
grandtotal += price_of_f[my.skill2];
}
if(mouse_right){//also make sure this only works when over an entity.
ent_remove(blah blah)
grandtotal -= price_of_f(blah blah);
}

Another option is to create a manager that knew every item in the screen and have it add up a total each cycle. This one could be buggy if not done right but could be more simple depending.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!