26 April 2026

Final Controller

 


https://youtu.be/AZuoEMlLxeE

Our controller for our game is a tank that was put together and has the controls inside like a normal tank. The way this model works well with our game is that it is a literal tank inside the tank game. We devised it to have the shooting button in the little gunner position and have its movements attached to the movement of the tank you hold. Our controller design has the connection in the back of the tank as if it was running on the gas you used in the tank. The logical side of our design is that whenever the player wants to move the character they need to go in that direction in order for the actual character to move in that direction. We also have it to where the button for shooting isn't being pressed quickly so the player can't repeatedly shoot over and over again at a fast speed. The way this controller connects to our game is that they are both tanks and they are also able to be controlled in a similar fashion or resemble a tanks capabilities in real life. We originally wanted to do a tank helmet which would make the player feel like they are inside the tank but we switched it to an actual tank design so the player really feels like they are controlling the tank in the game. How would you improve the engineering side of this tank and the internal mechanics?



  1. #include <Adafruit_CircuitPlayground.h> #include <Keyboard.h> //dead zone float forwardValue = 3.0; float backwardValue = -3.0; float leftValue = -3.0; float rightValue = 3.0; const int buttonPin = A1; bool lastButtonState = HIGH; //begin code void setup() { CircuitPlayground.begin(); Keyboard.begin(); pinMode(buttonPin, INPUT_PULLUP); } //detect angle output to x and y void loop() { float x = CircuitPlayground.motionX(); float y = CircuitPlayground.motionY(); // Up if (y > forwardValue) { Keyboard.press(KEY_UP_ARROW); } else { Keyboard.release(KEY_UP_ARROW); } // Down if (y < backwardValue) { Keyboard.press(KEY_DOWN_ARROW); } else { Keyboard.release(KEY_DOWN_ARROW); } // Left if (x < leftValue) { Keyboard.press(KEY_LEFT_ARROW); } else { Keyboard.release(KEY_LEFT_ARROW); } // Right if (x > rightValue) { Keyboard.press(KEY_RIGHT_ARROW); } else { Keyboard.release(KEY_RIGHT_ARROW); } // Button Z bool currentButtonState = digitalRead(buttonPin); if (lastButtonState == HIGH && currentButtonState == LOW) { Keyboard.press('z'); delay(50); Keyboard.release('z'); } lastButtonState = currentButtonState; }

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.