View Single Post
Old 05-25-2012, 03:35 PM   PM User | #2
djpaul1963
New Coder

 
Join Date: Apr 2012
Location: Athens GR
Posts: 58
Thanks: 0
Thanked 6 Times in 6 Posts
djpaul1963 is an unknown quantity at this point
The scoring variable of the space invaders is the var intScore:int = 0; on top of the code, where all variables are assigned. This variable gets increased in shotDown and shotDown2 functions where a collision between your shot and the alien has been detected.

Moving now to your treasure game, it's very easy to insert that variable increase below the lines you say "WAAAAHAYYYY, You found it".
Of course you must still define the variable on top of your program in a global position (I believe you know already about variable scope and when variables are visible only inside a function or not).

Happy coding!
djpaul1963 is offline   Reply With Quote
Users who have thanked djpaul1963 for this post:
fightapilotdean (05-31-2012)