-
Score counter in AS3
Hi everyone,
The game I'm making is a shooter: alienships fly across the screen and when I click them, they die.
I want to have a dynamic text that keeps score of the number of ships I kill, but I'm not managing to do it.
I have a "Main class" and an "Alienship class" in my game. This code is in the "Alienship class":
function Alienship():void
{
addEventListener(MouseEvent.CLICK,whenclick);
}
private function whenclick(e:MouseEvent)
{
trace("You're dead\n");
parent.removeChild(this);
}
It removes the alienship off the screen. But how can I have a variable that increments on each killing?
Thanks
Chiapa
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|