I am trying to make a tank game that operates like the old "Game and Watch" consoles. It has two buttons (I may add two more later) and nine textboxes, which makes for a pretty small playing field. A visual aid can be found HERE.
In order to make the tank move around, it would be pretty easy just to make a whole bunch of if loops like this:
So, is there another way? Is there a way I could use a single switch statement to take care of this? The following statement would return a variable that says whether or not the tank can move.
My last idea is the one that I would prefer to be able to use, but I'm not so sure how I might make it work. I would like to assign each text box a coordinate variable. I want cell A1 to be called 0,0; cell B3 to be called1,2 and so on. If I can't figure out how to do that, I would at least like to assign each cell an X and a Y variable so that if I say X+1, the tank will move to the box that is X+1.In the end I would like to be able to manipulate the tank with commands like these:
Tank = 2,0;Tankx = Tankx + 1;if (Tanky == < 0){Tanky = 0;}