Skip to main content
Known Participant
July 20, 2009
Question

Help with point system?

  • July 20, 2009
  • 1 reply
  • 378 views

I am making a shooting game. But I don't know what code to use to display score.

This is the entire script

var sfx_gun:Sound = new sfx();
var sp:MovieClip = new ship();
var tm:Timer = new Timer(1500);

tm.addEventListener(TimerEvent.TIMER, onstart);

var bulletholder:Sprite = new Sprite();

addChild(bulletholder);

addChild(sp);

addEventListener(Event.ENTER_FRAME,onenter);
stage.addEventListener(MouseEvent.CLICK,onclick);

tm.start();
function onstart(e:Event){
   
   
    var em:Sprite = new enemy();
    em.x= Math.random()*550;
    addChild(em);
   
   
    }


function onenter(e:Event):void {
    sp.x-=(sp.x-mouseX)*.1;
    sp.y-=(sp.y-350)*.2;
}

function onclick(e:Event) {
    sfx_gun.play();
    sp.y=365;
    var bl:Sprite = new bullet();
    bl.y=sp.y;
    bl.x=sp.x;
    bulletholder.addChild(bl);
}

ship is the ship

sfx is the gunshot sound

enemy is the target

bullet is the bullet

If you need more info please reply

This topic has been closed for replies.

1 reply

LPeekamanAuthor
Known Participant
July 20, 2009

For EX each enemie shot gives you 50 points

kglad
Community Expert
Community Expert
July 20, 2009

in your onenter loop you'll need to check if there's a positive hittestobject between any bullet and any enemy.