Kristaps Porzingis of the New York Knicks controls the ball...

Kristaps Porzingis of the New York Knicks controls the ball in the first half against the Sacramento Kings at Madison Square Garden on Sunday, March 20, 2016. Credit: Jim McIsaac

The Knicks’ medical staff put Carmelo Anthony in a dark room in an attempt to make his migraine feel better, but he left Madison Square Garden about an hour before tipoff Sunday night. And by the end of the game, there was plenty of pain to go around for the Knicks.

It was a winnable game against a team that has had a season similar to the Knicks, filled with unachieved expectations and drama. It was a game the Knicks could have won even without Anthony because of the Kings’ poor shot selection and decision-making on the offensive end.

But despite hitting only 39.8 percent of their shots overall and scoring only 19 fourth-quarter points, the Kings handled the Knicks, 88-80. The Knicks shot 35.2 percent and scored only 15 points in the fourth quarter.

“We weren’t able to score,” Kristaps Porzingis said. “It’s tough, and it’s frustrating.”

The Knicks (28-43), who lost for the 21st time in 27 games, returned from a six-game road trip, and their effort at the start of the game was predictable.

Interim coach Kurt Rambis held a walk-through before the game and said the players were “a little sluggish.” The Knicks needed more than 10 minutes to put 10 points on the scoreboard and trailed 28-12 after the first quarter.

They cut it to two with less than two minutes left in the third quarter but couldn’t get any closer. They drew to within 81-76 with 5:25 left in the game but scored only two more baskets the rest of the way.

“To me, guys looked tired,” Rambis said.

Robin Lopez had a 23-point, 20-rebound night. Jerian Grant scored 14 off the bench and Porzingis had 13 points, but he shot 6-for-17, air-balling a three-pointer in the final seconds.

Kings center DeMarcus Cousins had 24 points and 20 rebounds. Rudy Gay added 17 for Sacramento (27-42).

Anthony started complaining about migraine symptoms during the Knicks’ loss to the Wizards in Washington on Saturday night. Rambis said Anthony tried to take part in the walk-through but had “issues dealing with the lights.” The pregame treatment didn’t work, and Rambis said, “He just wasn’t getting any better.”

The same can be said for the Knicks, who are 0-8 without Anthony this season and have a losing record for the third straight year. Barring a miracle, they soon will be eliminated from playoff contention.

Kings coach George Karl, who coached Anthony with the Nuggets, was asked if his former player needs to play with another superstar to maximize his ability to win. But fearing a fine, Karl refused to answer directly.

“I think Carmelo’s a great player that’s had some bad success,” Karl said. “I would hope that he figures it out and they figure it out here in New York. What I’ve read, that’s what he wants.”

Anthony has been frustrated with the Knicks’ struggles and has sent some mixed signals during the past couple of months. The belief is that he wants team president Phil Jackson to make the necessary moves to turn the Knicks into a contender so he isn’t forced to waive his no-trade clause.

Jackson recently said “chasing a point guard where it just becomes an obsession isn’t necessary” because of the triangle system by which he swears. But point guard has been an area of need for many years for the Knicks.

Anthony would like to play with a top-flight point guard, and during the Knicks’ western trip, he made a pitch for Kings point guard Rajon Rondo, who will be a free agent this summer. Anthony said he believes Rondo would fit perfectly in the triangle.

Earlier in the season, Rondo denounced the triangle, saying it’s “not really a good look for me,” but he backtracked a little Sunday. Rondo called the system “effective” and “great for team chemistry.”

Rondo, who had two points and six assists in the victory over the Knicks, was asked if he could be successful in the triangle and responded, “Anything is possible.”

Notes & quotes: Cleanthony Early appeared in a game for the first time since being shot in his right knee during a robbery Dec. 30. Early, who was recalled from the D-League, played the last 19.3 seconds of the first half and didn’t register a stat . . . Kevin Seraphin (sore foot) and Lance Thomas (sore knee) sat out. X-rays of Seraphin’s left foot were negative . . . Rambis said newly signed guard Tony Wroten has “deficiencies in his injured leg” and won’t play this season. Wroten is rehabbing from a partially torn right ACL.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME