In a project using scenes, each scene is essentially it’s own “project”, and they’re all mashed together into one, where custom rules and variables all carry over.
So if you have a “when game starts” in scene 2, it doesn’t execute as soon as the play button is pressed, it executes as soon as scene 1 switches to scene 2.
If you have a shape art in scene 1, say, and switch to a trail art in scene 2, the trail art will only draw once you’re in scene 2, instead of as soon as the game starts / play button is pressed. So instead of going into scene 2 and having the trail art already created (as it would be if everything in scene 2 started as soon as we press play instead of when it switches to scene 2), we see the trail art being created.
To prevent that from happening, the “when I am created” block would execute everything as soon as the object existed, basically doing the trail art setup and start as soon as the play button was pressed, instead of waiting til it was scene 2
The current when game starts shouldn’t necessarily be “fixed” cuz it’s still useful in something like a platformer or other game with multiple levels.
All of the graphics and setup , for every scene / level could be done immediately using the “when I am created” block, but then you’d use the “when game starts” to start that level. Cuz if you didn’t have that, all of the levels would play simultaneously and that wouldn’t really be fun
Right but if you have like 50 scenes, that’d be kinda painful and really inconvenient-- a separate rule would probably be a lot more helpful, and there are still a lot of other uses for it
I was thinking it would also wait until the scene is showing, since it doesn;t really make sense for code to be running for objects which aren’t on the current screen. It would only happen the first time you enter the scene, though.
That’s true, but in some cases, it’d be so much easier to have them running as soon as the play button is tapped, like when you’re setting up a level or a background thta may take a while to load.
Be cool if there was a parameter or something in the block where you could specify exactly when/how it’d run.