Basic "Tag" Game

Hey everyone,

I am currently working on a basic game using a 2x16 parallax LCD screen and an Adruino Uno. So far i have the player character able to move up down right and left using 4 if statements and input from a controller I made on a bread board. Next i would like to make a monster npc that chases the player. I have made many programs like this before and am basing the code for my Adurino project after one I made in java script. I can easily make a single monster that chases the player around, again using about 4 if statements to control its movement and then one to detect when they are touching. However I haven't figured out how to add additional monsters using the same "brains" but having their own separate variables without adding more of the same code just with different variables. I did a little Minecraft modding before and I'm looking for something kind of like an entity files, where each 1 of the NPCs rendered can call on their file to know how to behave. If you need more info let me know. Any help at all would be great!

Thank you very much!
~aaaelite21

The Arduino is programmed in C++. That means classes. Create a monster class, and multiple instances of that class.

Wouldn't that just limit the number of monsters that could be spawned? For the sake of the game I was hoping to make it a Farly large number as I plan on getting a bigger screen soon. Or could a loop of some sort control the number of instance or "spawning" of that class?

Wouldn't that just limit the number of monsters that could be spawned

No why should it? It takes less memory to do that than to duplicate the code.

Awesome!!! Thank you very much!!!