Lesson 4

Now that we have an arduino that can both send and receive signals using infrared light, we can program it to play a basic game of laser tag.

Basic Laser Tag

We will start with a simple game of elimination. Each player has a tag unit, and the objective is to tag the other players 5 times. If you get tagged 5 times, you are out. The person who is left when everyone else is out is the winner.

So, how do we program the arduino to do this? We are nearly there. We already have code that sends in infrared signal (light pulsed 38,000 times a second) that our infrared receiver can receive. We also have code that checks to see if our receiver is receiving anything. What we need to do is add health. If you are out of health, then you can not send tags. Every time you receive a tag, your health goes down by one. You start with 5 health.

That's all there is to building a simple game of laser tag. From here, we are going to start adding bells and whistles to make the game more fun to play. But after you have completed this lesson and lab, you can play laser tag. Go for it. Write down what you liked and didn't like. If you want to change something, you can do it. This is your game of laser tag, and you can build it to do whatever you want. But first, let's make the code. To the code!

Leave a Reply

Your email address will not be published. Required fields are marked *