runtime.layout.addEventListener("beforelayoutstart",
() => OnBeforeLayoutStart(runtime));
// Attach the tick event to run the game logic over time.
runtime.addEventListener("tick", () => GameMethods.Tick(runtime));
// The player fires bullets when clicking, which is done in a mousedown event.
runtime.addEventListener("mousedown", e => GameMethods.OnMouseDown(e, runtime));
// Restart the game when pressing spacebar if the player was destroyed,
// which is done in a keydown event.
runtime.addEventListener("keydown", e => GameMethods.OnKeyDown(e, runtime));
// Create a new monster instance every 3 seconds.
setInterval(() => MonsterInstance.Create(runtime), 3000);
Pardon my french, but there is so many coding for something so simple and not explained in javascript course. And on the other hand in gamemaker this passage would be much shorter.
This is a big deal breaker for me, reason why I feel discouraged to code in Construct: there is no explanation of real game example - not running a code in a console - there are plenty tutorials and books on that, but a clear explanation why certain things are running the way they are in construct game. When "runtime." and everything that goes after "." is being used, same for "* as", "() =>", "e =>", etc. etc.
I understand that shooter example was just that, example, what it can be done, and that's great, but what about making a game dev course of making a simple game, like Pong, and dissecting the code there, especially parts of code that will repeat in almost every construct game, and I am not talking about operators, but why sometimes is "runtime.addEventListener" and sometimes it's "runtime.layout.addEventListener", and that sort of things, things that were quite different from coding in GameMaker Studio.
Sorry for long post and my rant, I really want to use js in construct but I don't want to use it to run text games in a console but actually to make a visual game and therefore I need to understand how to use JS in that scenario.