Alec Jerard Prestoza and Chris Medina
Team 12 Game Controller
Mortal Cage Fighter Glove
This is our alternative controller for the game Mortal Cage Fighter, which comes in the form of a glove. The conceptual model includes a workout glove in between some knitted gloves, to simulate the feeling of fighting or getting your hands dirty. In the game, the player will utilize multiple inputs in order to win a Best of 3 fight. Built for one’s right hand, flexing the thumb on the glove will cause the player to move left, and flexing the pinky will move the player right (the player also blocks when moving back from the direction they are facing). In terms of combat, flex the index finger to punch and the middle finger to kick. All of the inputs have been mapped onto flex sensors, with the only other input being the CPE’s shake function to jump. Like in other fighting games, Mortal Cage Fighter has Specials that can be executed with a sequence of inputs (in this game, they are: back -> forward -> punch/kick). Every fighter has their own unique Specials. The controller’s design incorporates signifiers by mapping specific finger movements to in-game actions. For example, flexing the index finger to punch or the middle finger to kick provides a clear signifier that guides the player’s movements. The feedback of the controller is visual (the character’s movements and combat actions). This helps players understand the results of their actions, providing a rewarding sense of cause and effect. In a simple game such as this one, the glove can afford to do everything that can be done on a keyboard, and it connects the use of handwear to a fighting theme that requires one to use their hands. Here is a question we have:
How can this controller be optimized further, in terms of the circuitry, coding, or design?
#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>//Alec Prestoza and Chris Medina (Team 12)//Final Project//Game: Mortal Cage Fighter//initializing variables for each of the inputsint shakeThresh = 30;const int FLEX1_PIN1 = A1;const int FLEX2_PIN2 = A2;const int FLEX3_PIN3 = A3;const int FLEX4_PIN4 = A4;void setup() {// put your setup code here, to run once:CircuitPlayground.begin();CircuitPlayground.setBrightness(50);Serial.begin(9600);delay(1000);}void loop() {// put your main code here, to run repeatedly:float x = CircuitPlayground.motionX();//variable to read how hard the CPE is shakenfloat shake = abs(CircuitPlayground.motionX()) + abs(CircuitPlayground.motionY()) + abs(CircuitPlayground.motionZ());//reading each flex sensor onto its respective pin on the CPEint flex1 = analogRead(FLEX1_PIN1);int flex2 = analogRead(FLEX2_PIN2);int flex3 = analogRead(FLEX3_PIN3);int flex4 = analogRead(FLEX4_PIN4);// Map flex sensor values to character movement (Left, Right arrow keys)int flex1Movement = map(flex1, 0, 1023, 0, 10);int flex2Movement = map(flex2, 0, 1023, 0, 10);int flex3Movement = map(flex3, 0, 1023, 0, 10);int flex4Movement = map(flex4, 0, 1023, 0, 10);//print values of each flex sensor to serial monitor belowSerial.print("\nFlex1: ");Serial.print(flex1);Serial.print(" | Flex2: ");Serial.print(flex2);Serial.print(" | Flex3: ");Serial.print(flex3);Serial.print(" | Flex4: ");Serial.print(flex4);//shake to jumpif (shake > shakeThresh) {CircuitPlayground.setPixelColor(1, 255, 0, 0);Keyboard.write(KEY_UP_ARROW);}//***bending a finger will peform corresponding action//flex index finger to punchif (flex1Movement > 7) {CircuitPlayground.setPixelColor(4, 255, 255, 0);Keyboard.write('j');}//flex middle finger to kickif (flex2Movement > 6) {CircuitPlayground.setPixelColor(5, 0, 255, 255);Keyboard.write('k');}//flex thumb to move leftif (flex3Movement > 5) {CircuitPlayground.setPixelColor(2, 0, 255, 0);Keyboard.press(KEY_LEFT_ARROW);} else {Keyboard.release(KEY_LEFT_ARROW); // Release left arrow key}//flex pinky to move rightif (flex4Movement > 6) {CircuitPlayground.setPixelColor(3, 0, 0, 255);Keyboard.press(KEY_RIGHT_ARROW);} else {Keyboard.release(KEY_RIGHT_ARROW); // Release right arrow key}//The Special Moves in the game can be executed using a sequence of the above if statements (left -> right -> punch/kick)CircuitPlayground.clearPixels();}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.