Double Tap event

Is there a specific double tap event in CocosSharp? How would I go about capturing the event?

Best Answer

Answers

  • JaredMathesJaredMathes CAUniversity

    Thanks Jeremy!

  • JHaasJHaas USMember, University

    This code example is conversely good for when you want to limit the rate at which taps are considered valid taps (use the else section instead).

    Nice share, @Flippy :)

  • FlippyFlippy USMember ✭✭

    Thanks @JHass. I'm happy to know that it helped someone else. I used some similar code for precisely what you mentioned. Preventing users from spamming a fire button on my game. =p

  • SP41KSP41K Member ✭✭

    Where do I get the elapsedTime property from?

  • FlippyFlippy USMember ✭✭
    edited February 2018

    SP41K,

    The elapsedTime property will be another global property you set on your scene. You will update it in your main game loop. See example below.

        float elapsedTime;            //Elapsed Time On Scene
    
        public Scene_GameLevel()
        {
            //............
            //Start the main game loop
            Schedule(RunGameLogic);
        }
    
        void RunGameLogic(float frameTimeInSeconds)
        {
            elapsedTime += frameTimeInSeconds;    
        }
    

    On a side note, I think CocosSharp is dead. If you're wanting to develop a game, you may be want to find a game library that is still supported and/or maintained.

  • SP41KSP41K Member ✭✭

    Thanks, Flippy.

Sign In or Register to comment.