Reset Transistor: Soldering/Coding advice

I'm not sure how to write it so that it works how I want.

Start in play mode>Play all recordings>Then reset

If tilted> Reset into play mode

Start in record mode> Record until tilted>Reset.

This (I hope) is the barebones code. I need to set up the reset mode but I do not know how.

Sorry if my code is sloppy.

#include <avr/io.h>
#include "config.h"
#include "filesys.h"
#include "player.h"
#include "vs10xx.h"
#include "record.h"
#include <SoftwareSerial.h>

const int groundpin = 66;           // analog input pin 4 -- ground
const int powerpin = 67;           // analog input pin 5 -- voltage
const int xpin = 65;                // x-axis of the accelerometer
const int ypin = 64;               // y-axis od the accelerometer

SoftwareSerial mySerial(2, 3);

void setup()
{
  Serial.begin(9600);
  
 /*Provide ground and power by using the analog inputs as normal
   digital pins.  This makes it possible to directly connect the
   breakout board to the Arduino. */

  pinMode(groundpin, OUTPUT);
  pinMode(powerpin, OUTPUT);
  digitalWrite(groundpin, LOW); 
  digitalWrite(powerpin, HIGH);

  
  InitSPI();
  InitIOForVs10xx();
  InitIOForKeys();
  InitIOForLEDs();
  InitFileSystem();
   Mp3Reset();
}


void loop()
{ 
  /*
Set X&Y axis to light up an LED if the accelerometer tips past 30 degrees in any direction from flat.
|| means 'or'
< and > mean greater or less than
*/  

// If at boot the Arduino is tilted past 30 degrees on the X or Y axis, Playback. If not then reset shield and enter recording.
   if (analogRead(xpin) > 589 ||analogRead(xpin) < 433||analogRead(ypin) > 589 ||analogRead(ypin) < 433  )
  {
   Play();     
  }
else
  {
    #if defined(__AVR_ATmega2560__)
   {
        Record();
   }
  #endif
  }
}