Description:
Our controller is a helmet that you can move your head to control your character. The way you control the character is by moving your head down you move the character forward, left, right, and backwards depending on how you tilt your head. We will have a button the player will be able to click for the menu that pops up and a switch to turn off the helmet controls. The player will also have a microphone attached so they will have to scream to either shoot with the tank or confirm on the menu. The way this correlates with our game is that in the game you are playing as a tank shooting your enemies and the helmet is supposed to be the driver inside the tank. You are going to be wearing a helmet like a tank helmet to give you the immersion.
Sketch:
Pseudocode:
Device: Circuit Playground Express
Goal:
Use the built-in accelerometer to control WASD movement.
Use the built-in microphone to trigger the Space key when sound is detected.
Use pin A3 as a shutdown input.
If A3 detects input, stop the whole controller.
If A3 does not detect input, keep running.
Include the Circuit Playground library
Include the Keyboard library
Set forward value = x
Set backward value = y
Set left value = a
Set right value = b
Set sound value = z
If A3 detects input
Release W
Release A
Release S
Release D
Release Space
Stop all controller actions
Else
Read accelerometer values
Read microphone level
If F/B tilted value higher than x, press W
Else, release W
If F/B tilted value lower than y, press S
Else, release S
If L/R tilted higher than a, press A
Else, release A
If L/R tilted higher than b, press D
Else, release D
If sound is higher than z Press Space
Wait briefly
Release Space
Release W
Release A
Release S
Release D
Release Space
Stop all controller actions
Else
Read accelerometer values
Read microphone level
If F/B tilted value higher than x, press W
Else, release W
If F/B tilted value lower than y, press S
Else, release S
If L/R tilted higher than a, press A
Else, release A
If L/R tilted higher than b, press D
Else, release D
If sound is higher than z Press Space
Wait briefly
Release Space

No comments:
Post a Comment
Note: Only a member of this blog may post a comment.