Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+3)

Code you add to the deck-level script is run every time any event is processed. Likewise, code in a card or widget script executes whenever an event is sent to that card (or a widget on the card), or an event is sent to that widget, respectively.

If the top-level script is just defining functions (aka event handlers) and constants this is fine and normal. If there's lots of code it can start to chew up a lot of the per-frame execution quota; this is when you might consider moving some scripts into different cards or modules.

There are some situations where more elaborate "bare" code outside event handlers is useful, but Millie is correct: most of the time, most of your code ought to go inside event handlers so that it only has a chance to start doing things when a specific event occurs.

(+2)

Makes perfect sense, thanks for clarifying! My galaxy brain thought “ah i’ll just put that one if-else in the top-level script so it can constantly and automatically check for the time”, but i definitely see how this kind of uncontrolled approach could very easily backfire, i’ll keep it in mind for the future :)