A teenage love triangle allegedly sparked a series of events that led to a 15-year-old boy who had nothing to do with it being killed, a court has heard.