loss of speed with this function ...why ?

Recommended Posts


when i comment this function my game run well but without comments the speed is not optimal. Could you tell me what i'm doing wrong or what to improve ?

ps : i give the image of my sprite, it maybe help some solutions....

Big thanks to you.

// specific function to create an sprite object with these parameters
image: "flash_blanc"

//to lock a function and be sure that the function not run twice
f.lock = (obj, callback) => {
	if (obj.flag == false) {
		obj.flag = true;

// launch tween
f.anim_flash=(obj,p)=>{ =game.add.tween(p.o).to({ alpha: p.a }, p.t, p.e, true, p.d, p.i, p.y);
	// reset the flag of the obj oncomplete ()=> {o.flash[1].flag=false},this)

//on input onDown launch the tween
f.stop_body = function () {
	if (o.paper[1].flag == false) {
		f.lock(o.flash[1], ()=> {f.anim_flash(o.flash[1],o.flash_tw_p1)})

// in update
game.input.onDown.add(f.stop_body, this);


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.