27 November 2023

An Unconventional Frogger Game Controller

 Hello all! Today, I bring you the unconventional game controller for Frogger, one of the most popular arcade games of all time. The design of the controller is built around the convenience of controlling the frog's movement by tilting the controller up and down, and turning the potentiometer left and right. The shape of the controller is made to look like the 2D sprite of the frog in the game, entirely modeled and 3D printed by me. However, I did not conceptualize the idea of the Circuit Playground Express mount. For the movement of the frog, I decided to have it be motion controlled due to the jumping nature of the frog in the game, and I wanted the player to be further invested in the game. The potentiometer was made as an easy alternative for left and right movement rather than relying on the accelerometer on the Circuit Playground Express for horizontal movement. I also feel like it would be easier for the player to quickly move left and right uninterrupted, and it would also not interfere with the up and down motions that the player would tilt their frog in. One of the things that has puzzled me the most in this project was how to have the wires more securely on the frog rather than with tape and wrapping it around the potentiometer. This could cause issues if the player unintentionally bumps the wires and they slide off during gameplay. I would like to avoid soldering, but it seems like that would've been one of the only choices I had to make. Regardless, this game controller is perfect at its job at maneuvering the frog from the side of the road onto the lily pads.



#include <Keyboard.h>
#include <KeyboardLayout.h>
#include <Keyboard_da_DK.h>
#include <Keyboard_de_DE.h>
#include <Keyboard_es_ES.h>
#include <Keyboard_fr_FR.h>
#include <Keyboard_it_IT.h>
#include <Keyboard_sv_SE.h>

#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  CircuitPlayground.begin();
  pinMode(CPLAY_SLIDESWITCHPIN, INPUT_PULLUP);
  delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:
  float y = CircuitPlayground.motionY();
  int sensorValue = analogRead(A1);
  if(digitalRead(CPLAY_SLIDESWITCHPIN)) // Safety Switch
  {
    /* If the player tilts the device forwards, they will go forwards. If they tilt it backwards, they will go backwards. */
    /* The delays are set to ensure the player has a steady tempo of proceeding in directions. */
    if(y > 3)
    {
      Keyboard.write(KEY_DOWN_ARROW);
      delay(600);
    }
    if(y < -3)
    {
      Keyboard.write(KEY_UP_ARROW);
      delay(600);
    /* If the player turns the potentiometer clockwise, they will go right. If they turn it counter-clockwise, they will go left. */
    }
    if(sensorValue < 350)
    {
      Keyboard.write(KEY_LEFT_ARROW);
      delay(600);
    }
    if(sensorValue > 570)
    {
      Keyboard.write(KEY_RIGHT_ARROW);
      delay(600);
    }
    Serial.println(sensorValue);
  }
}





No comments:

Post a Comment

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