22 October 2023

Scaffolding Review: Cookie Clicker the Clicker controller

So my controller aesthetically wants to match the game itself so what better way than that by making the controller look like the game itself, it makes the game which is usually dull of just clicking over and over with your mouse to now become a interactive game as we click the cookie in the game with a cookie itself outside of the game, so we put the cookie together with both halves to click on the cookie in the game meanwhile to just make it more interactive you have to break it apart everytime to make the cookie click again!


 






const int pResistor = A0:

const int xAxis = A1;         //analog sensor for X axis
const int yAxis = A2;         // analog sensor for Y axis

int range = 12;               // output range of X or Y movement
int responseDelay = 2;        // response delay of the mouse, in ms
int threshold = range / 4;    // resting threshold
int center = range / 2;       // resting position value
int minima[] = {1023, 1023};  // actual analogRead minima for {x, y}
int maxima[] = {0, 0};        // actual analogRead maxima for {x, y}
int axis[] = {xAxis, yAxis};  // pin numbers for {x, y}
int mouseReading[2];          // final mouse readings for {x, y}

void setup() {
  Mouse.begin(); //Lets me use the mouse functions!

}

void loop() {
  m = accelerometerMotionValue
  value = analogRead(pResistor);

  // read and scale the two axes:
  int xReading = readAxis(0);
  int yReading = readAxis(1);

  // move the mouse:
  if m > 1
    Mouse.move(xReading, yReading, 0); //Move right with tilt right
    delay(responseDelay);

  else if m < -1
  Mouse.move(xReading, yReading, 0); //Move left with tilt left
  delay(responseDelay);

  if (value < 25){
    Mouse.click(button); //click the mouse when the photoresistor is covered
  }
   
}

No comments:

Post a Comment

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