Video Game Concepts Vol. 1 (Combos) -
06-01-2009, 08:38 PM
I was going over some of the Alice worlds I've written in my spare time over the years and I've realized that a lot of them were centered around some concept in commercial video games that I'd seen/played and was trying to understand. Then I thought it might be fun to refine and post them to teach these concepts to everyone! So here's the first one: combos.
Background: More than a few people have posted asking about how to design a combo system using Alice. A friend of mine and I had worked on it for a short while with no success, after some thought I was able to replicate it.
Explanation: A combo is a set of methods in a game which are all called using the same action, but are called sequentially instead of simultaneously by repeating the action. Usually, the action has to be repeated quickly in order to perform the whole combo, otherwise the first method is called again.
Example: The samurai in my world performing three separate attacks, all triggered by pressing the space bar quickly three times in a row (within .2 seconds for each press)
Key Ideas: Since there is no way to initiate or interrupt a method in Alice while another method is running (unless they are run simultaneously), a similar method can be used. By infinitely looping a method which checks a number variable, strikeNum, the first attack is performed. Then, by checking to see if the variable has changed during the first attack, the second attack is performed. Finally, a third check to see if the number has changed during the second attack allows the third attack to be performed.
Application: Since infinite loops are cubersome and can often cause choppy animation in large quantities or in complex worlds, I'd recommend not using this in a large game.
Last edited by x2495iiii; 06-01-2009 at 08:44 PM.
|