Mark Foster said "sorry mate" when he trapped the constable with his car door on Bridge Place, after the Worksop Pride event, at around 9.20pm, on July 13.
The officer assumed Foster had stumbled, said prosecutor Robert Carr, but when it happened again, Foster said "sorry" sarcastically, and started laughing.
He slammed the door into the officer a third time, and was told to move away, as the officers were dealing with someone who was unconscious in a doorway.
Foster grabbed the rear nearside car door and slammed it on another constable's legs, and was arrested.
The court heard he was last in trouble in December, last year, for assaulting a police officer, when he received a conditional discharge.
Leslie Pidcock said the former lorry driver had "significant difficulties" with his mental health, and had been sectioned last year.
She said he had mixed alcohol with a new type of medication.
"He genuinely says "I am not someone who hates police - I wasn't myself,"" she said.
Foster, 45, of Grafton Street, admitted two assaults on the officers, when he appeared at Mansfield Magistrates Court, on Thursday.
Magistrates, who said they understood his situation at the time, revoked his conditional discharge and imposed a new one for 12 months.
He was ordered to pay £200 compensation to the officers, but no other costs were awarded.
For more of the latest cases from Mansfield Magistrates Court, click here.