How can I disable an even for a short time in the game.

0 favourites
  • 5 posts
From the Asset Store
Best soundtracks for any game. High quality and engaging assets.
  • I want to make it so the player is unable to shoot while an animation is playing. So while the two second reload animation is playing I want to disable an event and allow it to resume after.

  • Create a global variable or create an instance variable within the player and use to create a dual condition. Make it Boolean if it's an instance variable. Call it "Can_Shoot" and set it to true by default. When the two reload create an event to change the value to false, then change it back to true after they reload.

    On Key Press> Player > Spawn Bullets

    Player > Can_Shoot

  • or

    Make an instance variable (Can_shoot) for the player sprite (in the below example the player is Sprite)

    (one instance variable (number))

    and in this case the reload animation is named reload

    and when the reload animation is finished then......


    When you make the instance variable for the player sprite, the remember to set initial value of the Can_shoot instance variable to 1 when you make it.

  • or to be even more simple, getting rid of the necessity for a variable at all:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can some one tell me what's going wrong.

    I've tried a few methods that all seem to fit the correct logic but none of them have actually worked.

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