Description
The controller is a broom that the player tilts to move their character. The character’s movement in the game matches the broom’s movement in real life. The controller’s visual design is made to match an item from the game, specifically the vehicle that one of the characters rides on throughout the game. The player can hold the controller in a way that matches how the character rides on it. The inputs are made so that if the player holds the controller the same way the character does, the player’s movements to control the character will be identical to the character’s movements in the game. Moving the controller around moves the character in the same direction, with the movement animation involving the character moving the item in the same way.
Controller Sketch
Controller Schematic
Pseudo-code
void setup() {
// put your setup code here, to run once:
// Keyboard init + other set up things
}
void loop() {
// put your main code here, to run repeatedly:
AcceptInput();
MapInput();
ControlMovement();
ButtonEvents();
}
void AcceptInput()
{
// Read and cache raw inputs of sound sensor, distance sensor, and accelerometer XYZ values.
}
void MapInput()
{
// Map sound sensor value such that normal talking doesn't activate keyboard event, but shouting does.
// Map distance sensor value such that putting a hand over the controller's opening will activate keyboard event.
// Map accelerometer XYZ values to get the rotation of the CPE.
}
void ControlMovement()
{
// IF CPE is tilted forward:
// Move Forward Keyboard (W / Up Arrow)
// IF CPE is tilted backwards:
// Move Backwards Keyboard (S / Down Arrow)
// IF CPE is tilted left:
// Move Left Keyboard (A / Left Arrow)
// IF CPE is tilted right:
// Move Right Keyboard (D / Right Arrow)
}
void ButtonEvents()
{
// IF the mapped distance sensor value is high enough:
// Activate Focus (Shift Key)
// IF the mapped sound sensor value is high enough:
// Activate Bomb (Z Key)
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.