The controller is not fully finished, both in design and in code form.
My controller is supposed to be a motion-style one. Similar
to a Wii remote but in a bigger style. The game that I am going to use for the
project is space invaders, so the movement of the giant controller makes the
tank move in the game. I wanted to make look like the paddle of a tank room, with tons
of random buttons, directions, and a position to shoot at the target. The main
thing is that if you shake the box you can shoot at the game, it's not like in
real life but you can have a motion of action when you are shooting. You have
to be careful around so the wires and the circuits don’t get messed up. I am
still working to make sure that it's not that stable once is fully working. In comparison
to the game, I think it fits the style of space invaders really well, you have a
little action and the enough that make you excited and play around more and
more.
This is how I plan to be the circuits of the controller and how the system will fully work inside.
https://www.free80sarcade.com/spaceinvaders.php
Here is the video that explains in better detail what is going on with the design and my point of view.
Questions:
1- Should I try to change my codding in what matters?
2-Should I make some other movement for the controller or not?
Note: The codding is not fully done yet. I am mid way on how to work it. i hope to fully get it right,
I hope it works in some matter.
float x = CircuitPlayground.motionX();
float y = CircuitPlayground.motionY();
float rad = atan2(y, x);
Serial.print(x);
Serial.print("\t");
Serial.print(y);
Serial.print("\t");
Serial.print(rad);
Serial.print("\t");
delay(20);
CircuitPlayground.setPixelColor(0, 255, 0, 0);
delay(40);
//Moves the neopixel through each LED like a marble
int neonum = mapfloat(rad, -PI, PI, 0, 10);
neonum = neonum - 2;
if(neonum < 0) neonum += 10;
CircuitPlayground.clearPixels();
CircuitPlayground.setPixelColor(neonum, 30, 30, 30);
//CircuitPlayground.playTone(50, 1000, true);
CircuitPlayground.colorWheel(8);
delay(20);
Serial.println(neonum);
}
//Declares mapfloat
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
float result = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
return result;
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.