Sign in to follow this  
Chokitu

Boost Velocity Phaser

Recommended Posts

Hey everyone, I am really new to Phaser so If i ask something really stupid, I am sorry in advance, lol. 

 

 

I created an item named Redea that will boost the player speed for 15 seconds and change his sprites for 15 seconds, after that everything goes back to normal (this item will be activated when the player collides)

 

I created the collision and everything but the speed is not changing and I can't seem to change the sprite, can anyone help me here??

 

That's what I got

 

P.S The variable playerVelocity is because I was told that it can mess up with the physics if we tween the velocity.

 

Btw, I need to make it only appear sometimes on the same spot, tho.

 

Can anyone help me with that?

redeaFun: function(){
        
        this.emitter.x = this.redea.position.x;
        this.emitter.y = this.redea.position.y;
        this.emitter.start(true,500,null,15);

        this.playerVelocity = {x:0, y:0};
        
        this.game.add.tween(this.playerVelocity)
         .to({y: 500,x:500}, 5,true);
    
    },

update: function() {

    this.player.body.velocity.x=this.playerVelocity.x;
    this.player.body.velocity.y=this.playerVelocity.y;

}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.