Where do I learn how to access objects in javascript?

I was trying to figure out How to access the mouse coordinates from javascript code event.

The wiki page on JavaScript code has a lot of helpful examples. . . but it doesn’t it have a reference to mouse coordinates.

I found reference to MouseX and MouseY by searching the forum but while this works in the action block of an event, it does not work in Javascript.

Eventually (after a lot of searching) I found a forum post [Solved] How do I get mouse location in JavaScript Event which has the answer.

But my question is . . . where do I go to learn what is accessible and how from javascript? Like I said, the wiki page has some useful examples but it doesn’t have everything. Just one example:

runtimeScene.getGame().getInputManager().isKeyPressed(LEFTKEY)) checks if the Left key is pressed. But what other functions are available from the getInputManager? Where can I go to learn everything I can do with it? What are the constants for every key? Is TILDEKEY how I check if the Tilde key is down?

Maybe I’m looking at it wrong but the documentation doesn’t seem to be complete. There’s lots of 404s

1 Like

Hello!

First, please keep in mind that the Event logic system is the only first class language in the engine. Javascript logic based events are definitely available, but not 100% the intent of the engine.

That said, the full JS API is available and linked from the Wiki page: GDevelop JavaScript game engine

image

This includes all of the inputs for all of the GDJS api calls in the engine, including input manager and the such.

image

Hope this helps

1 Like

Hi thank you very much for that link, it’s close to what I was looking for.

I think the wiki page on javascript code tries to link to it, but the link it actually has ( https://4ian.github.io/GD-Documentation/GDJS%20Runtime%20Documentation/ ) goes to a 404 error.

But I still wasn’t able to find a list of keycodes. (I thought this page would enumerate them https://docs.gdevelop-app.com/GDJS%20Runtime%20Documentation/GDJS_Runtime_inputmanager.ts.html ) but it doesn’t.

I believe GDJS expects full javascript keycodes and not friendly names, but I could be incorrect.

If I’m right, you can check any JS keycode here: https://keycode.info

Edit: I believe I found the old link you are referencing on the Wiki page, I’ve updated it, but if you find any more feel free to let me know.