20 November 2024

Diddy Kong's Hat: Team 2 Alternative Game Controller Project

 Diddy Kong's Hat: Team 2 Alternative Game Controller Project

By Sebastian and Austin 




Our alternative controller is the Diddy Kong Hat Controller for the game Donkey Kong Country. Ever wanted to feel more like a Kong? That’s exactly what our controller delivers! By wearing the Diddy Kong Hat, you can physically embody the movement of the characters through intuitive and immersive controls. The conceptual model is simple: the player's head movements map directly to the character's actions. Tilting your head to the left or right moves Donkey and/or Diddy Kong in the corresponding direction, while tilting your head upward makes them jump—just like the natural motions of the characters when navigating the jungle.

The potentiometer on the hat allows for additional input actions. By "rolling" the potentiometer forward, you trigger actions like rolling, grabbing, or sprinting; rolling it backward triggers climbing actions on ropes and ladders. The limited sensor set—just the Circuit Playground Express (CPE) accelerometer and a potentiometer—serves as an elegant signifier of the game's controls: head tilting and analog input are the sole interactions, emphasizing simplicity and a direct connection to the theme.

This design highlights affordances by mimicking the Kongs’ physical movements, reinforcing the immersive experience. The tilt controls reflect the characters’ natural body mechanics during gameplay, and the analog potentiometer input adds a tactile and fluid layer to the actions like rolling and climbing, which feels in line with the organic flow of the game. Visual and auditory feedback from the game directly matches these inputs, ensuring clear communication between player actions and in-game responses. How might we further enhance the immersive connection between the Diddy Kong Hat controller and the game’s jungle theme while maintaining simplicity in design?


Our Arduino Code: 

#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_hu_HU.h>
#include <Keyboard_it_IT.h>
#include <Keyboard_pt_PT.h>
#include <Keyboard_sv_SE.h>

#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>
//TEAM 2 Sebastian and Austin
//Diddy Kong's Hat: Donkey Kong Country Alt Controller

// Pin for the potentiometer
const int potPin = A1;

void setup() {
  // initiate
CircuitPlayground.begin();
Keyboard.begin();
}

void loop() {
 
 // Get accelerometer readings
  float x = CircuitPlayground.motionX();
  float y = CircuitPlayground.motionY();

  // Thresholds for tilt detection
  float threshold = 2.0;

  // Potentiometer threshold for jumping
  int potValue = analogRead(potPin);
  int jumpThreshold = 256;  // Around a quarter of 1023 (the max analogRead value)


   

  // Check for down tilt
  //Which is tilting "Up" on the hat
  if (y < -threshold) {
 Keyboard.press('x'); // X key
  } else {
    Keyboard.release('x');
  }

  // Check for right tilt
  if (x > threshold) {
    Keyboard.press(KEY_RIGHT_ARROW);
  } else {
    Keyboard.release(KEY_RIGHT_ARROW);
  }

  // Check for left tilt
  if (x < -threshold) {
    Keyboard.press(KEY_LEFT_ARROW);
  } else {
    Keyboard.release(KEY_LEFT_ARROW);
  }
 // Check potentiometer for jump state with validation
  if (potValue > 10 && potValue > jumpThreshold) {  // Added a minimum threshold to ignore floating values
    Keyboard.release(KEY_UP_ARROW);
    Keyboard.press('s');  // S key for rolling/throw
  } else {
   Keyboard.release('s');
   Keyboard.press(KEY_UP_ARROW);  // Press Up Arrow key for climbing ropes and ladders
   
  }

  delay(100);  // Small delay for smoother operation
}

Video Demonstration:


No comments:

Post a Comment

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