[SOLVED] Losing and Winning the game problem

It is hard to follow, so no problem.

Does it work for you now?

Nope can’t seem to code it

this.on(‘destroy’, function() {
this.app.mouse.off(pc.EVENT_MOUSEDOWN, this.mouseDown, this);
});

do i just copy this and put it on the same script as the shoot?

Can you show me the initialize function of that script please? That’s where you create and destroy events.

image

// initialize code called once per entity
GunShoot.prototype.initialize = function() {

    // Event for mouse button left fire
    this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.mouseDown, this);

};

this one right?

Yes, that’s where you have to put the example code on line 6.

[quote=“Albertos, post:17, topic:30156”]

this.on('destroy', function() {
    this.app.mouse.off(pc.EVENT_MOUSEDOWN, this.mouseDown, this);
});
`
so i just simply paste it?

Yes.

2 Likes

it work thank you so much!!

2 Likes