wanted a tutorial on how to load and shoot like mega-man.
Please stick to english on the forums, thanks!
that would be awesome to learn!!!
Develop games in your browser. Powerful, performant & highly capable.
Do you mean charged shots?
you need to make a counter for charged shots. The action of shooting is executed when you're not pressing a particular key. But you'd also need to limit that within the value of a counter so that you're not ALWAYS shooting.
1) when X is pressed constantly, +1 to counter
2) when X is not pressed, while counter is >10, shoot charged shot, limit action to 1 if it loops. Set counter to 0
That's the gist of it. It can become a bit buggy depending on how the loop is defined and how the engine resets the counter.
You don't need a loop. I'll do an example in a bit.
Here's a small cap of how I would do it
By adding timedelta to charge when the charge button is down, it increases charge by essentially 1 per second, so to reach the small charge bullet, you would hold down charge for more than 1 second, but less than 3 etc, so you can change the values I used in the subevents to however many seconds you want to charge for each level of charge.
The other reason I'm using timedelta is because if you did something like, 'add 1 to charge variable', it would add 1 per tick, meaning, people with faster computers could potentially charge their guns faster! Having it add per tick also means each charge level has to be a much higher value (like 60ish for one second of charge time). Timedelta however, behaves the same regardless of frames per second (there are exceptions but we won't go there! )
Enjoy! If you need further elaboration, please let me know