A teenager obsessed by murder wanted to carry-out a mass shooting at his own school, a court heard.