The Donkey Kong controller is a custom sun hat equipped with ultrasonic and sound sensors, blending gameplay mechanics with the game’s visual theme. The hat, a collectible item in the game, emphasizes its significance and ties the physical controller to the virtual world. This dual-purpose design enhances the sense of immersion, as players use a real-world item that has value within the game.
Four ultrasonic sensors are embedded in the hat, each linked to a directional movement. Players can hover a hand or the themed monkey toy over the sensors to navigate, mimicking Donkey Kong's natural movement in a jungle setting. The hat also features a sound sensor that detects noise or a yell, triggering a jump, aligning with the game’s action-driven dynamics. This design connects visual elements with gameplay, making the controller a seamless part of Donkey Kong's world. Please note that the hat isn't missing color—it is intentionally white. In the game, the hat is designed to be a white sun hat.
Sketches
Pseudocode
// Initialize and configure sensors// Declare variables for ultrasonic sensors: leftSensor, rightSensor, forwardSensor, backwardSensor// Declare variable for sound sensor: jumpSensor// Define threshold distance for ultrasonic sensors to detect hand or toy movement// Define sound threshold for jump detection
void setup() {// Initialize all sensors// Set pin numbers for each sensor:// - leftSensor attached to Pin X// - rightSensor attached to Pin Y// - forwardSensor attached to Pin Z// - backwardSensor attached to Pin W// - jumpSensor attached to Pin V// Initialize communication with the computer to send key presses}void loop() {// Read data from each ultrasonic sensor// leftDistance = read distance from leftSensor// rightDistance = read distance from rightSensor// forwardDistance = read distance from forwardSensor// backwardDistance = read distance from backwardSensor// jumpLevel = read sound level from jumpSensor// Check each sensor's state and trigger corresponding actions// LEFT MOVEMENT// If leftDistance is less than threshold// Simulate pressing the "D" key (move character left)// Send "D" key press to computer// Else, if leftDistance is greater than threshold// Release the "D" key (stop moving left)// RIGHT MOVEMENT// If rightDistance is less than threshold// Simulate pressing the "A" key (move character right)// Send "A" key press to computer// Else, if rightDistance is greater than threshold// Release the "A" key (stop moving right)// FORWARD MOVEMENT// If forwardDistance is less than threshold// Simulate pressing the "W" key (move character up)// Send "W" key press to computer// Else, if forwardDistance is greater than threshold// Release the "W" key (stop moving up)// BACKWARD MOVEMENT// If backwardDistance is less than threshold// Simulate pressing the "S" key (move character down)// Send "S" key press to computer// Else, if backwardDistance is greater than threshold// Release the "S" key (stop moving down)// JUMP ACTION// If jumpLevel exceeds the sound threshold// Simulate pressing the "Space" key (jump)// Send "Space" key press to computer// Else, if sound level is below the threshold// Release the "Space" key (stop jump)}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.