27 November 2023

Game Controller: Kermit The Frogger

Images:

My game controller project is for Frogger. The idea of my controller is to have a physical representation of the frog that can be manipulated by the player to move in game. To do this, I used a Kermit the Frog plushie with the circuit playground inside, with wires going through the arms and legs that connect to conductive tape on the hands and feet. When the hands/feet are connected, current flows from the circuit playground through the arms/legs, back into the input, which completes the circuit and moves either forward or backward. The accelerometer in the playground is used to move left or right using motion controls. 

Some signifiers are the conductive tape pads on the hands and feet showing that they have a purpose. There is also barely visible wire at the shoulders and hips that are different colors, showing that the arms and legs are to be used separately for different functions. The feedback is shown when the player moves in Frogger, and it is designed to make sense directionally because tilting left and right moves left and right, touching front hands moves forward, touching back legs moves back. The motion controls are programmed to be used when the controller is face down, similar to the position the frog would be in game. The directional controls and matching the frog’s position to its in-game position are designed to make the controller easy to understand. 

How could I have incorporated more feedback within the controller to let the player know what they’re doing?

Schematic:


#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>

char forward = KEY_UP_ARROW;
char back = KEY_DOWN_ARROW;
char left = KEY_LEFT_ARROW;
char right = KEY_RIGHT_ARROW;

int onForward = 0;
int onBack = 0;
int onLeft = 0;
int onRight = 0;

const int debounce = 50;

void setup() {
  CircuitPlayground.begin();
  pinMode(A3, INPUT_PULLUP);
  pinMode(A6, INPUT_PULLUP);

  Keyboard.begin();
  Serial.begin(9600);
  delay(1000);
}

void loop() {
  float move = CircuitPlayground.motionX();
  if (move > 4) {
    //move right
    if (onRight == 0) {
      Keyboard.write(right);
      onRight = 1;
    }
    delay(debounce);
  } else if (move < -4) {
    //move left
    if (onLeft == 0) {
      Keyboard.write(left);
      onLeft = 1;
    }
    delay(debounce);
  } else {
    onLeft = 0;
    onRight = 0;
    delay(debounce);
  }

  if (digitalRead(A3)) {
    //move forward
    if (onForward == 0) {
      Keyboard.write(forward);
      onForward = 1;
    }
    delay(debounce);
  }
  else if (digitalRead(A6)) {
    //move back
    if (onBack == 0) {
      Keyboard.write(back);
      onBack = 1;
    }
    delay(debounce);
  } else {
    onForward = 0;
    onBack = 0;
    delay(debounce);
  }
}
Video: 


No comments:

Post a Comment

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