2 Replies Latest reply on Feb 8, 2017 11:27 AM by ClayUUID

    Where can I find code for these minigame features? (fast tapping, collecting objects with cursor)

    meganl58828861 Level 1

      I'm building a game using Adobe Animate, and I want to have some 'minigame portions' within it. I'm planning to have some basic minigame functions listed below, but I am unable to find code for them anywhere. I often see these features in online Flash games, so I was wondering if there is anywhere I can get code for these features from:

       

      - Tapping the spacebar as quickly as possible to fill up a bar (the bar will deplete over time).

      - Using the cursor to touch moving objects to fill up a meter.

       

      For the second feature, I'd like to know if there is a way to lock the player's cursor within the boundary of a Movieclip? I'm planning to have the game within a Movieclip, rather than using the whole Scene for it. Also, I'd like to know if there's a way for the moving objects within my MovieClip to disappear once they move past the boundary of my Movieclip. Is it possible to make my objects move using the Timer function? I thought of using the Timeline to make them move, but since I want the speed of the moving objects to change depending on the difficulty setting, and I want a 'random direction' element, I think using the Timer function would be more efficient.

        • 1. Re: Where can I find code for these minigame features? (fast tapping, collecting objects with cursor)
          kglad Adobe Community Professional & MVP

          here are some tutorials, Search results

           

          and you can use google to search for specific snippets.

          • 2. Re: Where can I find code for these minigame features? (fast tapping, collecting objects with cursor)
            ClayUUID Adobe Community Professional

            meganl58828861 wrote:

             

            I'm building a game using Adobe Animate, and I want to have some 'minigame portions' within it. I'm planning to have some basic minigame functions listed below, but I am unable to find code for them anywhere. I often see these features in online Flash games, so I was wondering if there is anywhere I can get code for these features from:

            You're talking about stealing large chunks of code from other people's projects. What you should be doing instead is sitting down and figuring out every low-level step necessary to implement each minigame in your project. For example...

            - Tapping the spacebar as quickly as possible to fill up a bar (the bar will deplete over time).

            This is not a "feature" of Animate, it's a collection of features working in concert to create a system. For this interaction you will need to learn how to:

            • Render a bar with a dynamic width
            • Create a timer that fires at a specified interval and decrements the bar width
            • Fire an event based on keyboard input
            • Determine which key was pressed in the event handler
            • Create logic for the bar running out
            • Create logic for the bar filling up

             

            These are things you can ask specific questions about. Like these...

            if there is a way to lock the player's cursor within the boundary of a Movieclip?

            Oh god no. Animate absolutely cannot take control of the mouse pointer. That would be a nightmare vector for malware.

             

            Is it possible to make my objects move using the Timer function?

            The Timer class is AS3 only. If you're working in a Canvas project, the underlying CreateJS library provides a global Ticker, which you can attach event listeners to. You can also run code at arbitrary intervals by using setInterval.