How do i prevent clicking spam?

0 favourites
  • 2 posts
From the Asset Store
Click! Click! 136 click sounds for your video games or media projects
  • TL/DR: Title if player clicks too fast, games becames too easy, how do i create a cooldown on the mouse clicks?

    I'm still a bit of a beginner in the engine. I searched through the beginner tutorials and didn't find a conclusive answer to my question, so I've come here to seek help (I feel like I'll be coming here many more times).

    The game I'm creating is for the purpose of studying the engine, and it's basically a top-down hack-and-slash game with battlebots. With each click, my bot punches.

    My issue is that the bot punches at the same speed as the player clicks the mouse button, and if they click very quickly, the game becomes too easy.

    So how do I create a cooldown between the clicks to prevent this?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The easiest way to do this is with a variable:

    Global variable lastClick=0
    
    
    Mouse On Click
    lastClick<(time-0.2)
    ... Set lastClick to time
    ... Player set "punch" animation
    

    This way there will be 0.2s cooldown between punches.

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