23 October 2024

Team 3's Progress Review

Fireboy and Watergirl Controllers

Labeled Fireboy and Watergirl controllers.


Description

Fireboy and Watergirl is a popular local two-player flash game that the players play on one keyboard. We wanted to keep the co-op concept going by creating two different controllers that are modeled after the two characters in the game. For movement, both controllers will use the potentiometer to move the character left and right.

Each controller will have two arms, one of the arms will be an external switch that can toggle between the two characters. If both arms are facing the SAME direction, then the character being controlled is the SAME as the controller character. If the arms are facing DIFFERENT directions then the character being controlled is the DIFFERENT character of the controller. 

The Fireboy controller will make the character jump when the heat sensor reads a significantly higher temperature than the average temperature measured in the room. The Watergirl controller will jump when the microphone reads a significantly higher sound level than the average measured in the room. We decided to use different inputs for the jump mechanic because we felt that the heat sensor felt perfect for Fireboy considering his element, and sound works for Watergirl because of rain.

 

Schematics

 


 

Pseudocode

 There will be two separate codes. One for each controller:

 Fireboy Controller

void setup{
    //set variables
    External Switch - Toggle
    Potentiometer - Movement
    External Thermal Sensor - Jump (Fireboy)
    
    TemperatureThreshold

    Find average temperature
       sum of values
    number of values taken
    
    //for-loop to add the values together a number of times
    for (int increment = 0; i < number of samples; increment++) {
               read current temperature from sensor
               add the current temperature to the sum
               delay between readings
    }
    
        average temperature = sum of values / number of values taken
}

void loop{
    //external switch used to toggle between characters.
    if (external switch is on){
        //then controller is set to Fireboy's controls

        //moving
        if (potentiometer reads less than 500){
            then the key pressed down is left arrow key to move left
        }else if (potentiometer reads greater than 523){
            then the key pressed down is right arrow key to move right
        }else{
            no key input to stand still
        }
    
        //Fireboy Controller with Fireboy Controls toggled
        read current temperature from sensor
        if (thermal sensor reads more than a certain value above the average thermal sensor values){
            then the key pressed down is up arrow key to jump
        }

    }else{ //external switch is off
        //then controller is set to Watergirl's controls
    
        //moving
        if (potentiometer reads less than 500){
            then the key pressed down is the A key to move left
        }else if (potentiometer reads greater than 523){
            then the key pressed down is the D key to move right
        }else{
            no key input to stand still
        }

        //Fireboy Controller with Watergirl Controls toggled
        if (thermal sensor reads more than a certain value above the average thermal sensor values){
            then the key pressed down is W key to jump
        }
    }
}


Watergirl Controller

void setup{
    //set variables
    External Switch - Toggle
    Potentiometer - Movement
    Microphone - Jump (Watergirl)

    SoundThreshold
    
    Find average sound levels
       sum of values
        number of values taken
    
        //for loop to add the values together a number of times
    for (int increment = 0; i < number of samples; increment++) {
        current temperature - read sound levels from microphone
        add the current sound levels to the sum
        delay between readings
    }
    
        average sound levels = sum of values / number of values taken
}

void loop{
    //external switch used to toggle between characters.
    if (external switch is on){
        //then controller is set to Watergirl's controls
    
        //moving
        if (potentiometer reads less than 500){
            then the key pressed down is the A key to move left
        }else if (potentiometer reads greater than 523){
            then the key pressed down is the D key to move right
        }else{
            no key input to stand still
        }
    
        //Watergirl Controller with Watergirl Controls toggled
        read current sound level from microphone
        if (microphone reads more than a certain value above the average sound levels){
            then the key pressed down is the W key to jump
        }

    }else{ //external switch is off
        //then controller is set to Fireboy's controls
    
        //moving
        if (potentiometer reads less than 500){
            then the key pressed down is left arrow key to move left
        }else if (potentiometer reads greater than 523){
            then the key pressed down is right arrow key to move right
        }else{
            no key input to stand still
        }

        //Watergirl Controller with Fireboy Controls toggled
        Take  the average input of sound levels in the room.
        if (microphone reads more than a certain value above the average sound levels){
            then the key pressed down is the up arrow key to jump
        }

    }
}

No comments:

Post a Comment

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