01 November 2023

Pokemon Ranger Prototype

 My controller is a glove that uses the accelerometer to move around the mouse and a switch with the thumb and index finger to click down. This relatively simple design works for a very fun, yet challenging way to play the Pokemon Ranger game. Pokemon Ranger is a game that was on the Nintendo DS Console and could be played entirely using the touch screen, it involves moving around and entering battle with Pokemon that you need to Circle with your "Styler" to capture. That's where this controller comes in, you use the accelerometer and switch to mimic touching down on a screen and drawing circles, however the use of motion controls makes for a harder yet still rewarding gameplay experience that gives the player a sense of accomplishment when they successfully capture pokemon using their own control of motion.


This prototype utilizes the accelerometer for mouse movement and connects wires from one of the 3.3Volt Pins to a pad of Tinfoil on the middle finger and the A1 pin to a pad of Tinfoil on the thumb to act as a switch, which reads as a mouse click in the code.

I showed off the functionality of the prototype in Paint.



Code Below

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

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

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

    float x = CircuitPlayground.motionX(); // mouse up and down movement
    if(x < -1)
    {
      Mouse.move(0, yDir);
    }
    if(x > 1)
    {
      Mouse.move(0, -yDir);
    }
 
    float y = CircuitPlayground.motionY(); // mouse left and right movement
    if(y < -0.5)
    {
      Mouse.move(xDir, 0);
    }
    if(y > 0.5)
    {
      Mouse.move(-xDir, 0);
    }

    if(digitalRead(A1)) // mouse press and release
    {
      Mouse.press();
    }
    else
    {
      Mouse.release();
    }
  }
}



No comments:

Post a Comment

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