BANGOR — The Wells boys’ basketball team had just seen its season end with a 39-38 loss to Cape Elizabeth in the Class B South final, and Matt Sherburne needed to step away from the game he had been playing for four varsity seasons.

“It hurt,” Sherburne said of the loss. “I took a little break, it was like a week and a half off. I didn’t touch a basketball since (that) game.”

When this weekend rolled around, however, Sherburne was ready to get back on the court for the Maine McDonald’s All-Star Basketball Games.

“(The loss) sucked for a while,” he said. “But it’s just fun to get out here and play with the guys.”

For a few teams and players, the basketball season ends in glory, with a Gold Ball and an unblemished run to a state championship. For everyone else, however, the season slams to a halt after a loss.

The All-Star games can be a way to cope with a difficult playoff defeat, or a way to say goodbye to the high school game while playing with friends, teammates and peers.

“There’s nothing worse than seeing someone play their last sports game,” said Hall-Dale forward Ashtyn Abbott, whose team fell in the Class C South final. “For some of the people here today, this could be the last organized basketball game that they play, forever. So it’s definitely good to get one more chance, especially if this is your last time.”

The games match the best seniors from the North and South, with players from Classes AA, A and B in one game and players from Classes C and D in the other. And they give players who weren’t ready for basketball to be over a more fitting farewell.

“You definitely don’t want your last game ever to be on a tough loss like that,” said Winthrop’s Layne Audet, whose team lost as a No. 2 seed in the C South semifinals. “To come in and have this fun game was kind of like closure. … I really liked having this one last game to go to the banquet and really get acknowledged for this. This is one of the best ways a senior can go out.”

“It definitely is a really good way to go out,” agreed Scarborough’s Josie Couture, whose team fell to Oxford Hills in the Class AA state final. “Obviously, we came close, we didn’t quite make it, so this is just a good way to kind of wrap it all up and go out on a good note.”

Rivals became teammates Saturday. Skowhegan’s Sydney Ames and Annie Cooke and Hampden’s Bailey Donovan got to team up a little more than two weeks after battling for the Class A North title. At one point in the C/D boys’ game Abbott called to Winthrop’s Cam Wood, who hounded him throughout the Class C South final, for a full-court pass.

“You hate to play against them during the regular season,” Abbott said. “But once you’re on the same team, they’re like your best friends.”

It was a point echoed by Couture, who now got to pull for, rather than against, players like Gorham’s Mackenzie Holmes, South Portland’s Katie Whitmore and Greely’s Anna DeWolfe.

“It definitely is a weird thing, thinking ‘Oh, you were my No. 1 enemy during the season, and now we’re on the same team,'” Couture said. “Obviously Mackenzie Holmes and Anna DeWolfe, you never want to cheer for them during the season. But to watch them up here has been really fun.”

It doesn’t beat a Gold Ball, but it does beat the feeling of a stinging defeat being a final high school basketball memory.

“It’s just the excitement to be (out) here with my best friends,” Whitmore said. “And getting the chance to play with them one last time.”