Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Gameframe

Custom window frame for GameMaker games · By YellowAfterlife

[Fixed in 1.0.1a] Buttons duplicate after a game_restart()

A topic by Chillax created Dec 11, 2022 Views: 143 Replies: 2
Viewing posts 1 to 3
(3 edits)

This probably is not important but I didn't see it mentioned anywhere in the documentation, so I might as well point it out.

While the usage of the game_restart function is usually only for debugging (so normally this won't be an issue), I noticed that the buttons duplicate, so you end up having a stack of buttons after restarting the game a few times. I assume it has to do with the gameframe_init function being repeated on each game start without a proper cleanup when the game restarts.

How the buttons look after restarting the game twice:

Developer(+1)

Rather, it’s because game_restart doesn’t re-run global scripts (read: code outside of function() declarations)

It sure feels like this function only gets more cursed with each new GameMaker feature

(1 edit)

Oh, pain, but that actually makes sense. So, all it really takes is to make sure that on game_restart all of Gameframe's global stuff is set again but that's just a bandaid to an issue Gamemaker is making from their misleading name function honestly.

At this point, I can see why some people hijacked game_restart to do things their own way instead of relying on it.