A 12-year-old boy knew the man accused of shooting him outside a sandwich shop, prosecutors have said.
The victim was shot in the thigh in a drive-by shooting on Northern Avenue in Sheffield on 12 January.
Sheffield Crown Court heard the boy told police he saw a car drive up and “they started shooting everywhere” then heard the gunman shout “we got one”.
Stephen Dunford and Devon Gregory, both from the city, deny attempted murder and other firearm offences.
Prosecutor, Stephen Wood QC, said the boy had been standing with a group of friends outside the shop on Northern Avenue.
A white Ford Focus approached at 15:30 GMT and shots were fired, but the boy may not have been the intended victim, Mr Wood said.
“The prosecution say it was the intention to kill, it may be they hit the wrong person, that does not matter. If they intended to kill but ended up shooting [a] boy the prosecution submit they are guilty of attempted murder.”
Mr Wood said the boy told police: “Dunford and four of his friends were in the car, all were wearing hoods or balaclavas.
“They started shooting everywhere.”
Mr Wood said even though the suspect was wearing a hood, the boy could see Mr Dunford’s eyes and eyebrows and recognised his voice.
“He heard the gunman shout, ‘we got one’,” Mr Wood said.
The victim’s father knew Mr Dunford and the boy said he had seen him the night before.
A second gunman, who the victim did not recognise, was in the rear passenger seat and the prosecution said that person was Mr Gregory.
A gun was later found at the flat of a drug addict, who was known to Mr Gregory, and she told police he must have left it there, the court heart.
Mr Gregory, 23, of Heeley Green, Sheffield, and Mr Dunford, 25, of Fellbrigg Road, both deny attempted murder and possessing a firearm with intent to endanger life.
Mr Dunford also denies a charge of possessing a firearm with intent to endanger life in relation to a separate shooting in Sheffield on 10 January.
A third man, Brandon Bailey, 26, of Manor Park Way, Sheffield, denies a charge of possessing criminal property.
All three deny a charge of conspiracy.
The trial continues.