The controller we made for Run, is designed to create an immersive experience with gesture-based inputs. A flex sensor is incorporated into the wristband to trigger jumps when the user bends their wrist, mapping this motion to the spacebar. Additionally, a sound sensor moves the player left, while a proximity sensor moves the player right by sensing arm distance from the body. This hands-free controller aligns with the simple mechanics of Run, where timing and movement are crucial. The minimalist and ergonomic design not only complements the game's aesthetics but also encourages physical interaction, making the gameplay more dynamic and fun.
Sketch:
Schematics:
Pseudo Code:
// Setup and initialize the sensors and Circuit Playground Express
Initialize flex sensor, sound sensor, proximity sensor, and accelerometer on Circuit Playground
// Define thresholds for the sensors
Set flex sensor threshold for jump detection
Set sound sensor threshold for left movement
Set proximity sensor threshold for right movement
Set tilt threshold for tilt-activated wristband sensors (left/right movement)
// Main loop to continuously check sensor values
Loop forever:
// Check flex sensor for jump
If flex sensor value exceeds the jump threshold:
Trigger jump
Else:
Release jump key
// Check sound sensor for left movement
If sound sensor detects sound above the left movement threshold:
Trigger left movement
Else:
Release left movement key
// Check proximity sensor for right movement
If proximity sensor detects distance below right movement threshold:
Trigger right movement
Else:
Release right movement key
// Small delay to prevent overwhelming the system
Delay (100 milliseconds)
// End loop
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.