Sign in to follow this  

How to stop Player movement completely for a few seconds

Recommended Posts

I would like it so that when a certain event happens, the player completely stops moving (for a few seconds or so), the user does not have the ability to move at all, and I am then able to proceed to call a function (which calls a function to end the game). How would I implement this? 


Here is a snippet of code located in my Update function:

(Please note: I am using the Phaser basic template, so when calling functions and methods, we must use 'this'. 

        if (, certainItem)) {            var hit ='hit');  ;            certainItem.kill();            player.body.velocity.x = 0; // Tried to stop, but I am still able to move him  'hit'); // Changes to the frame I wanted but then quick            //-ly changes back            //            this.gameOver();        }

Thank you in advance. 

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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.