[JS] RTFM: A cheat sheet for the manual's features

13

Features on these Courses

Contributors

Stats

2,851 visits, 3,805 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 3 Aug, 2019. Last updated 16 Apr, 2020

This short tutorial will sum up all the tiny things you should know about if only you took the time to read the manual. I will try to keep this up to date with new features, but I won't just copy/paste the docs. For full info on everything, rtfm: construct.net/en/make-games/manuals/construct-3/scripting/overview

  • Global scope is accessed using globalThis and not window or this. globalThis is made available on every browser and in worker mode, so it will never break
  • Global vars are accessed using runtime.globalVars
  • Local vars are accessed using localVars
  • Functions are called using runtime.callFunction(name, ...params)
  • Function params are also accessed using localVars
  • Function return value is set using runtime.setReturnValue(value)
  • DeltaTime is accessed using runtime.dt
  • Objects are accessed using runtime.objects
  • Subclasses are set using runtime.objects.objName.setInstanceClass(SubClass)
  • Subclasses must be set in the runOnStartup function
  • Mouse and Keyboard can either be accessed using runtime.mouse or runtime.keyboard or using runtime.addEventListener(name, callback) with the following events: "keydown", "keyup", "mousedown", "mousemove", "mouseup", "dblclick", "wheel", "pointerdown", "pointermove", "pointerup", "pointercancel"
  • On start of layout is done by using runtime.layout.addEventListener(name, callback) with one of the following events "beforelayoutstart", "afterlayoutstart"

.

  • 3 Comments

  • Order by
Want to leave a comment? Login or Register an account!