How do I block the player movement for a time ?

0 favourites
  • 14 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hello,

    I want when the player make a wrong movement and touch something he shouldn't.

    The screen shake the player and make a movement back.

    I figure out how doing it.

    My problem is the player can continue to move before before the return to the previous position and it make bugs everything.

    Basically i need to unallowed the player to move.

    Is it possible?

  • When they touch the object, disable the movement behaviour, then enable it again when you've set the new position.

  • I don't use the movement behaviour. The player move like in a boulder dash with the keyboard but i will probably also use touch for when it bill be on smartphone

  • Simply create a group called "Player Movements" and move all movement events here. Now you can deactivate and activate the whole group in order to disable player movement as required.

  • did i need construct 3 licence to do it?

  • I believe so but am not sure. I do know that each extra group you use eats up from the events limit in the free version.

  • Just add an extra condition (a variable) to whatever condition you're using to move the player and set this variable on collision, reseting it to allow movement when the events are resolved. If you tell us how you're moving the player, I can be more specific.

    For instance, if you're using the Keyboard object it would be something like this:

    if (Keyboard is Down && movingAllowed == 1) {
    	<Move the character>
    }
    
    
    On collision {
    	Set movingAllowed = 0;
    	Wait X seconds;
    	Set movingAllowed = 1;
    }
    
    

    Cheers!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Are you really using construct?

  • Yeah. This is fake code just to illustrate.

    Like I said, if you're more specific, I can give you a more specific method.

    Cheers.

  • Sorry to disturb you again, but i will like if you know how to do it.

    I just can't make it work

  • Just add an extra condition (a variable) to whatever condition you're using to move the player and set this variable on collision, reseting it to allow movement when the events are resolved. If you tell us how you're moving the player, I can be more specific.

    For instance, if you're using the Keyboard object it would be something like this:

    > if (Keyboard is Down && movingAllowed == 1) {
    	<Move the character>
    }
    
    
    On collision {
    	Set movingAllowed = 0;
    	Wait X seconds;
    	Set movingAllowed = 1;
    }
    
    

    Cheers!

    I see what i need to do but is construct allow us to do that?

    I need to make a condition.

    If blue is in collision with tilemap make 1

    If red is in collision with tilemap make 1 except if blue is also in collison.

  • Sorry, I can't find any working solution.

  • Show us your project or at least the part that does the movement

  • Ok I think I get.

    I create a variable movement : "on"

    Every time the player try to move i add a condition, system check if variable = on

    When the player touch an ennemy i put the variable to off wait 1 second, put the variable to on.

    Thanks for your help everybody and my apologyze to make so long to understand.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)