18 April 2022

Game Controller Final Project

 Video




Image






This project is an attempt to make an alternative method of control for the classic video game, Pac-Man. The thought process behind the creation of this controller was to create a simple, yet different, from of control than the one we, as an audience, have grown accustomed to. In its design, the controller is meant to represent the character Pac-man. The controller’s main method of control, the potentiometer, has even been fashioned to aesthetically function as Pac-Man’s eye. The controls for this project are straightforward, from left to right the controls alternate from moving Pac-man left, up, down, and then right. This may seem odd at first, but I believe that within this limited scope, it was the easiest and most effective way of offering control over the game to the player. The black knob jutting out from the otherwise flat Pac-man controller is meant to be inviting to players. This way, players are naturally made curious about the knob’s use and interact with it. Through interaction players can grow accustomed to the new controls by observing how Pac-man reacts to their input on the screen. Pac-man has a cultural familiarity that must be leveraged here. In leveraging said cultural familiarity, players have an easier time learning a slight modification in controls. The audience is familiar with the game; therefore, they understand how it should logically operate. This allows for the design to be slightly more obtuse in indication than other types of controllers. My question would be on the topic of whether or not this type of controller creates an effectively new and varied way to play a familiar classic. Does the controller succeed aesthetically and functionally?

Schematic



Code

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

//Ian Smith Game Controller Project

//A boolean to detect when the input should be read, that way we are not constantly sending keyboard signals.
bool On;

//Here are the established limits for each direction.
int Alim = 255;
int Wlim = 510;
int Slim = 765;
int Dlim = 1023;

void setup()
{
  CircuitPlayground.begin();
  pinMode(CPLAY_SLIDESWITCHPIN, INPUT_PULLUP);
  Keyboard.begin();
}

void loop()
{
  //Reading the potentiometer into the variable potRead.
  int potRead  = analogRead(7);

//Making the loop output a keyboard signal depending on whether or not the switch has been activated.
if (digitalRead(CPLAY_SLIDESWITCHPIN))
{
  On = true;
}

else if (!digitalRead(CPLAY_SLIDESWITCHPIN))
{
  On = false;
}

if (On == true)
{
    if (potRead >= 0 && potRead <= Alim)
  {
    Keyboard.write('A');
  }

  if (potRead > Alim && potRead <= Wlim)
  {
    Keyboard.write('W');
  }

  if (potRead > Wlim && potRead <= Slim)
  {
    Keyboard.write('S');
  }

  if (potRead > Slim && potRead <= Dlim)
  {
    Keyboard.write('D');
  }
}
}





No comments:

Post a Comment

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