gameplay logic added

very extremely not pretty code done. New score highlighted in magenta.