Step 5Programming part 2: Shooting a missile
Now at the end of the script add this:
wiimote.Led1=wiimote.dot1vis
wiimote.Led2=wiimote.dot1vis
wiimote.Led3=wiimote.dot1vis
wiimote.Led4=wiimote.dot1vis
This will make the LEDs on the wiimote light up whenever it can "see" an infrared light. This makes it easier for you to see if the wiimote receives any IR signal.
Now we are going to add the shooting.
This is going to be a little more complex than the previous lines of code, but i hope you understand it. At the end of the script add the following:
if wiimote.dot1vis=true then {
if wiimote.dot1x>412 and wiimote.dot1x<612 and wiimote.dot1y>412 and wiimote.dot1y<612 then {
keyboard.Enter=true
keyboard.Enter=false
}
}
The first line checks if the wiimote can "see" any IR signal. The 2nd line checks if the IR light is in the center of the wiimotes "field of view". If it is, the launcher should be aimed correctly, and the launcher will shoot a missile. If your missile launcher software does not use Enter for firing the missiles, you should change "keyboard.Enter " to whatever key your software uses.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|








































