17 April 2022

Space Invaders Controller (Leonardo Maranhao)

 


The idea for this controller was to bring like the panel of the tank that attack the invaders to life. With a combination of arts and craft, plus some good coding you are able to bring the tanks to life and shoot at the horrible invaders. The control is purely intuitive, you start moving to create most of the movements, like going left and right and then shooting at the invaders. The design of the controller is a bit bulky, but it’s the intention, originally it was to be like the size of the Steel Battalion controller which is massive and pretty much the same as a whole table. While making it, I figure out that this controller is kind of a fragile style if not played in a certain way it can end up pretty much not working for the gameplay. I choose the Space Invaders game, because it is the most simple gameplay for an arcade-style, all you have to do is go left and right and then shoot. Another inspiration for the controller was those old pongs controllers back at the old age at home gamming, they were huge, and you need enough space on your lap to make sure they actually work. I also added some sound code, in order to hear the shoot from the tanks when hitting the invaders. The overall concept was to make sure that the little ship worked in the same way as the arcade format, while moving might give some problems still makes the same functions and attacks as the original. The code took longer because I need it something to fully support the idea and the connection between the controller and the game, it was hard, and kindly show me that even a small game like the original space invaders can take a long time in order to make a control that can work properly in a laptop.




#include <Adafruit_CircuitPlayground.h>


#include <Adafruit_Circuit_Playground.h>


#include <math.h>


#include <Keyboard.h>



//init variables 


bool xDown;


bool yDown;


int xMove;


int yMove;




void setup() {




  Serial.begin(9600);


  Keyboard.begin(); 


  CircuitPlayground.begin();


}




void loop() {



  float y = CircuitPlayground.motionY(); //Gets motion in Y direction (technically Z)



  Serial.println(y);


  // -9 to 9


  if (y < -5) {

    Keyboard.write(216);

  }

  if (y > 5) {

    Keyboard.write(215);

  }



//Check for buttons


  if (CircuitPlayground.leftButton() == true) {


    Keyboard.write('X');


  }


  if (CircuitPlayground.rightButton() == true) {


    Keyboard.write('Z');


  }


//motion outputs thresholds to integers


}

https://www.youtube.com/watch?v=NGD2FQfUkrI

Question: Do you think the way I capture the screen with the gameplay was a bad angle? Or I could have used some other method?

Note: This might not be my best work, but I need what I could

 

No comments:

Post a Comment

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