“F”gaming + wiiflash
Ok guys this is it, in this little whitepaper I will introduce you to three great classes which will speed up game development based on the wiimote and with that I also mean using a very comfortable application the “Wiiflash server”.
These classes were tested with the latest (.3.2) version of Wiiflash, by the way I noticed this version allows me to rumble and press buttons at once
thanx guys!.
Download the classes & demo apps here
Now I will describe each class inside the asblabs.wiimote package:
wiimoteIR: this class was intended to emulate the pointer or cursor with no problems at all, in fact if you check the “wiiflash fair” (everyone remember it by the ducks) you’ll notice it doesn’t have any formulas or algorithms to control the target movement, in fact the whole movement is in charge of any of the infrared sensors, so if one desappears the cursor goes to the next IR Led, this technique is easy to implement but hard to get it running correctly, a common user would attempt to move the pointer to any direction expecting the cursor will follow the wiimote’s direction.
Then I came up to this idea, no matter if one of the IR points is missing, the code should attempt to behave as if the IR point were still there, so for a common user the movement of the wiimote normally is fast and tends to lose at least once one IR point. With this solution you can move the wiimote and even rotate it and if you lose a point the code will attempt to make the cursor behave smooth and naturally. The wiiflash package has already a built-in solution; use the controlMouse feature, you can use both and find the one you are the most convinced with. If you feel you find a bug for this particular class (WiimoteIR) just let me know :-D, in the demo package I included to sample fla’s one with inline code of the equation and the other using the same piece of code translated into a class.
Remember you must be away at least the double of your sensor bar’s width.
WiimoteLeds:This class is a funny one
, because this class allows you to create animations simple by entering the wiimote led values, (the demo package teaches you to use the built-in animations and create new animations) The simplicity of the class is just awsome and its performance is just stunning!
, you can create animations such as you create Timers in AS3, just enter the name of the new animation,led sequence,duration of each sequence and times to repeat the sequence. I’m sure you’ll find it useful and tons of fun using it.
WiimoteButtonSequences: This is the most powerful and maybe the most useful class of the package, this class is an engine that allows you to create combinations of buttons in order to perform certain tasks, the most wonderful thing is that this class is a generic class, so it can be easily ported to any of your current projects, not only games but applications which requiere shortcuts or complicated combinations using the wiimote
This class allows you to create two types of combinations
- Sequences-(SEQ) a sequence is a combination that is executed after you have pressed one button after the other. For example imagine you are playing a flash version of The king of fighters or Street fighter, there are special “combos” that are executed after you pressed one button after the other, for instance the common one is to create a semi-circle with the pad and then press any button. This combo can be easily added to the engine just by adding the buttons that must be pressed in sequence, the sequence time is 180 miliseconds, quite a short time but enough for most common for regular players
- Simultaneous (SIM) is as its name says when you press simultaneously a list of buttons. for example [right,a,b]
In case you are developing games that require constant pressing, for example racing games, there is a repeater function which controls when a button is trying to get repeated, for instance you accelerate by keep pressing button A, then the engine will prompt you with the current state of buttons. and much more!!! the demo application teaches you how to create both kinds of combinations and give it a try it I’m sure you’ll find creating games with the wiimote even faster and overall easier.












