15 March 2026

Scaffolding Work In Progress- Team 10

 Undertale- Flowey Controller


We made a custom game controller for the game Undertale (2015). We were thinking on how best to really fit the theme of the game, this led us to deciding on taking the form of an actual physical flower serving as a representation of the game's main villain- Flowey. For the movement mechanics we wanted to go for four photo resistors in each of the petals. These work as the WASD keys since the player when the cover the sensor with their hands it registers that input. Just in case we installed two potentiometers on the left and right to allow changes in the sensitivity. This is so in menus, overworld, and combat have different speeds allowing better control. We put the Circuit Playground Express in the middle and we are going to start using a sound sensor to work as the main mechanic the "enter" key. By clapping or shouting it registers the dialogue, combat hit, and menu selections. This makes the game way more physically interactive then it normally is.



Pseudo WIP Code:

// INCLUDE LIBRARIES! // Core Circuit Playground library. // Keyboard library so the CPE can act as a USB keyboard

// DECLARE PINS AND VARIABLES // Define pin numbers for the 4 external photoresistors (Up, Down, Left, Right). // Define pin numbers for the 2 external potentiometers. // Variables for the light readings in each petal. // Variable for the light sensitivity calculation because of the potentiometers. // Enable the sound in the CPE microphone.

// SETUP FUNCTION // Set up the Circuit Playground. // Define the WASD keys and enter key. // Set the 4 photoresistor pins as INPUTs. // Set the 2 potentiometer pins as INPUTs.

// LOOP FUNCTION

// 1. SENSITIVITY // Read the values from the potentiometers. // Map the potentiometers values to the light photoresistors. Turning=sensitivity.

// 2. READ SENSORS // Read the analog light values from the 4 photoresistor pins. // Read the current sound level from the Circuit Playground's built-in microphone.

// 3. PROCESS MOVEMENT (WASD) // If the designated petal is covered by light and reads a '0' value the read that directional petals key. Up petal=W // Else: if the photoresistors read any light value the input is not registered and no key is pressed. // Repeat process for each of the directional keys 'WASD'

// 4. PROCESS ACTIONS (Sound) // If the sound level is louder than a specific defined value threshold then press the "enter" key. Usually targets a loud spike of sound like a clap. // Add a short delay like around 100ms to prevent the key from auto pressing every second. // Else there's no sound then release the "enter" key // Add another small delay at the end of the loop.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.