Summary
The game controller we decided to make is for the game Mortal Kombat 1996. The idea was to make a game where you mimic the in-game mechanics and actions with in-person movements of the same degree. For example, a punch would trigger a punch, a kick would trigger a kick, etc. It's almost like you're fighting something in real life! We ended up with the final project being a punch triggered a punch, a kick triggered a kick, the platform to the left and right triggered the right and left movements, the back button triggered a high kick (since the diodge is just moving back adn that is triggered by moving back with our game version), the front button triggered a jump, and the lever on the side triggered a block. The concept idea was to make a full-body controller, and that is what we accomplished. When it came to wiring, we used various wires we had available to route each piece back to the Circuit Playground and the breadboard. For some pieces of the controller, everything was routed to the breadboard, minus the wire that let the part know what its job was (the part connected to a pin in the Circuit Playground). The CP provided the power and the code data required for all of our items to work. By wiring the ground and power to the breadboard, we were able to neatly manage the cables, as well as open up more space for our controller pieces to work. Once the power had gone through the breadboard and the different pieces, the power then returned back to the breadboard, which routed it back to the ground on the CP. Connected to the CP were some of the pieces parts themselves. The parts that connected to the pins to receive information are what were connected to the CP solely for the purpose of making the game run properly. The signifires of our game relies on people having some experience with other video games (like DDR) and knowledge of things like push pads. When you realize that the floor is basically WASD (or arrows to hit), the punch pads mean to hit them, and the lever is like a grabbing motion, the controller isn't hard to figure out. Once you do any of these movements, the game immediately reacts with the dedicated action in-game for you to progress. What would you improve with this design?
Controller front
Controller Side
Controller in action
Schematic
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>//may god help this project#include <Adafruit_CircuitPlayground.h>#include <Adafruit_Circuit_Playground.h>const int knob = 0;const int button1 = 4;const int button2 = 1;const int button3 = 2;const int button4 = 3;//top hit padint fsrtopAnalogPin = 7;//bottom hit padint fsrbottomAnalogPin = 6;int fsrtopReading;int fsrbottomReading;float timing = 0.0;float distance = 0.0;float duration = 0.0;unsigned long t = 0;int sum;void setup() {// put your setup code here, to run once:pinMode(button1, INPUT_PULLDOWN);pinMode(button2, INPUT_PULLDOWN);pinMode(button3, INPUT_PULLDOWN);pinMode(button4, INPUT_PULLDOWN);//these next few lines of code were for the WASD movements//WASD has been remapped in game for us, but these can still be used if you want arrow keys//pinMode(upButton, INPUT);//pinMode(downButton, INPUT);//pinMode(leftButton, INPUT);//pinMode(rightButton, INPUT);Keyboard.begin();Serial.begin(9600);}void loop() {// put your main code here, to run repeatedly://knobsum = analogRead(knob);//make sure it reads correctly//Serial.println(sum);if(sum <= 760){Keyboard.write('Z');//Serial.println("high kick");}//Pressure sensor 1 (top)fsrtopReading = analogRead(fsrtopAnalogPin);//Serial.print("FSR top reading = ");//Serial.println(fsrtopReading);if(fsrtopReading >= 500){Keyboard.write('S');delay(5); }//Pressure sensor 2 (bottom)fsrbottomReading = analogRead(fsrbottomAnalogPin);//Serial.print("FSR bottom reading = ");//Serial.println(fsrbottomReading);if(fsrbottomReading >= 500){Keyboard.write('X');delay(5); }//button(s) (move/dodge/jump)if(analogRead(button1) == 1){//Serial.println("on");Keyboard.write('K');}if(analogRead(button2) == 1){//Serial.println("on");Keyboard.write('I');}if(analogRead(button3) == 1){//Serial.println("on");//Serial.println("down");Keyboard.write('J');}if(analogRead(button4) == 1){//Serial.println("on");Keyboard.write('L');}}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.