badimo57_7416's Forum Posts

  • 5 posts
  • Ashley,

    Declaring such a variable creates scope issues with the others. Moving all the variables also prevents 'export' from working due to scope rules. Unfortunately, JavaScript also doesn't allow type setting. See https://developer.mozilla.org/en/docs/web/javascript/reference/statements/export for the export syntax. It is quite strict on where variables come from. It seems to specifically be for me, because if you do such a thing (without runtime of course) on my website, it will work. However, 'import' will refuse it.

    > function getRuntime(runtime) {
    	return runtime;
    }
    

    This function is pointless - it just returns its parameter.

    This is what you said to try in one of your tutorials, Ashley

  • Hi,

    I am trying to create a script called modules.js, but I can't use runtime anywhere, because it shows as undefined. Here is my code, attempting to do what Ashley suggests:

    // Import any other script files here, e.g.:
    // import * as myModule from "./mymodule.js";
    
    function getRuntime(runtime) {
    	return runtime;
    }
    
    import animate_playbackState from "./animate.js";
    import animate_directionalState from "./animate.js";
    
    // Global variables
    var playerInstance = getRuntime(runtime).objects.iPlayer.getFirstInstance();
    
    runOnStartup(async runtime =>
    {
    	// Code to run on the loading screen.
    	// Note layouts, objects etc. are not yet available.
    	
    	runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
    });
    
    async function OnBeforeProjectStart(runtime)
    {
    	// Code to run just before 'On start of layout' on
    	// the first layout. Loading has finished and initial
    	// instances are created and available to use here.
    	
    	runtime.addEventListener("tick", () => Tick(runtime));
    }
    
    function Tick(runtime) {
    	// Animate.js
    	if (animate_playbackState) {
    		switch (animate_directionalState) {
    			case 'up':
    				playerInstance.angle = 270;
    			case 'down':
    				playerInstance.angle = 90;
    			case 'left':
    				playerInstance.angle = 180;
    			case 'right':
    				playerInstance.angle = 0;
    		}
    	}
    }
    
  • As a project manager, you could just use a cloud file hosting service, like Dropbox (I use Git), and have Tovuti use your SCORM model. Using SCORM with Construct 3 isn't exactly a good idea.

  • Dear Ashley,

    Sure everyone knows that the definition of unreliable software engineering is, well, this topic. But when you cut off people's access to engine internals like you do right now, it makes it almost impossible to integrate with the engine. It takes me 3 hours to write a script that displays text! At least let people control the runtime, just not the engine itself.

  • You do not have permission to view this post

  • You could make the obstacles more vague, increasing collision sizes maybe, or making conditions that apply before the object moves. You could also use Line of Sight to determine if it can see its destination.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You do not have permission to view this post

  • 5 posts