26 November 2023

Pokemon Ranger Controller Final Project


This is a Controller for the game Pokemon Ranger: Guardian Signs. The reason why I chose this game is because I loved this series when I was younger and there hasn't been a Pokemon Ranger game since Guardian Signs in 2010. I thought that the gameplay being mainly touchscreen based with the objective being to circle Pokemon to capture them would be an interesting idea for making a custom controller for. So I had the idea to make the controller into a glove similar to the Capture Styler gloves that are seen in the game. To do this I strapped the Adafruit Circuit Playground to the back of an Archer glove and sewed conductive thread and fabric into the glove to create a switch that when you clench your fist presses down on the emulator with the mouse as if you were touching the touchscreen of a DS, and I set the mouse cursor controls to the accelerometer and used a map to make the motion more fluid and allow the controller to make more jarring movements to speed up mouse movement to make it easier to circle a moving target. Another reason why I chose Guardian Signs as the Pokemon Ranger game for the project is because it has a tutorial section that jumps straight into the action to make it easy to demonstrate what the controller can do and how it functions.



#include <Mouse.h>
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_CircuitPlayground.h>

void setup() {
  pinMode(CPLAY_SLIDESWITCHPIN, INPUT_PULLUP);
  Serial.begin(9600);
  CircuitPlayground.begin();
  pinMode(6, INPUT_PULLDOWN);
}

void loop() {
  if(digitalRead(CPLAY_SLIDESWITCHPIN)) // flip switch to have the Playground take over the controls of the mouse.
  {
    char xDir = 1.5; // mouse speed
    char yDir = 1.5;
    int mouseState = 0;

    float x = CircuitPlayground.motionX(); // mouse up and down movement
    float y = CircuitPlayground.motionY(); // mouse left and right movement
    int mx = map(x, -10, 10, 2, -2);
    int my = map(y, -10, 10, 2, -2);
    Mouse.move(my, mx);

    if(digitalRead(6)) // mouse press and release
    {
      Mouse.press();
      mouseState = Mouse.isPressed();
    }
    else
    {
      Mouse.release();
    }
    Serial.println(mouseState);
  }
}

 




No comments:

Post a Comment

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