PDA

View Full Version : I need some help with simple adding and subtracting wifh actionscipt



sterling silvr
October 24th, 2007, 08:19 AM
In a collision i need to learn how to subtract or add with a text field i made. This is a two player game, so i need two sets for health and amo. And i also need to lean that if it reaches zero that it would go on to any other scene. I would appreciat if anyone could help me out. :q:

Jerryscript
October 24th, 2007, 11:35 AM
Textfields contain strings, not numbers, so you have two choices:

1-convert the textfield string to a number with parseInt or by mulitplying by 1

2-store your values to be added/subtracted in a variable, and set the textfield to display the current value after any math is performed

I recommend 2.