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.