chunchun's Recent Forum Activity

  • Save and load in the event table cannot read and save the global variables declared in the JS file.

  • Save and load in the event table cannot read and save the global variables declared in the JS file.

  • How can I get the value of this parameter in JS

  • Note also the documentation for the behaviors property in the scripting reference for instances.

    Hope to add code prompt about "behavior" as soon as possible !!!!!

  • Thank you for your answer!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've got an instance of this behavior, so how can I call it?

  • I used keyboard. iskeydowm to judge, but it can only be used with a hold-down, not just press once.

  • Take a look at the 'Ghost shooter code' example. That stores various instances in global variables, which can also be used in scripts in event sheets.

    Thank you for your answer. I learned a lot from this <Ghost shooter code>.,I got a lot of help with this question. Thank you.

    In addition, is < await ()> equivalent to "wait" in the event table? I don't know how to use him yet. How do you make it wait a few seconds in script?

  • Each script block in an event sheet has its own scope, so local variables aren't shared. If you want to share something between them, you could use global scope instead.

    I'm not a professional, but it's great to be able to break down the scope barriers between blocks of code. Those that are retrieved once (retrieved instances) can be invoked directly in all blocks of code only once.

  • In each block of code, for example:

    	const a =runtime.object["a"].getfrisinstances();
    	
    

    We hope to get an instance of a once, and then call a. ***() in each script block.

    Instead of getting an instance of A once in every block of code that needs to call A.

    That makes it feel better to take advantage of the logical clarity of script code and reduce more useless code.

    For example, I wrote in the first code box: const a = runtime. obkect ["a"]. get ** ** ();

    Then I can call the instance a directly in each individual script box.

  • Refer to the Scripting reference in the manual for available scripting APIs. For example if you look up the Sprite object's script interface you'll see animationName is read-only, and there is a separate method to set it.

    Thank you for your answer. I still want to know how to control behavior with code. I see that the updated project already has script control to behavior over 8dir and platforms.

  • In different script blocks, those variables or instances that are retrieved need to be retrieved and invoked once with const. Is there any way that you can use it again and again with only one call without use const in every script blocks?

chunchun's avatar

chunchun

Member since 20 Jun, 2019

Twitter
chunchun has 1 followers

Trophy Case

  • 5-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

9/44
How to earn trophies