Change object settings through Javascript

0 favourites
  • 5 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • HI

    How can i change Opacity and Friction below through javascript

    const box1 = runtime.objects.Sprite.getFirstInstance();

    box1.angleDegrees = 45;

    box1.opacity=("50%");

    box1.Physics.Friction = (1.0);

    thankyou

  • 	const box =runtime.objects.box.getfristInstance();
    	const beha =box.behaviors.Physics;
    	box.angel=45;
    	box.opacity=0.5
    	beha.Physics.Friction =1.0;
    
    This is not necessarily the correct code, you need to go to the document to query parameters. This is the right way of thinking. You can refer to!
    
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hi

    tried the above as well as the code below,

    im stull unable to change Elasticity

    const box =runtime.objects.box.getFirstInstance();

    const beha =box.behaviors.Physics;

    const bay = box.Behaviors.Elasticity

    box.angleDegrees=45;

    box.opacity=0.1;

    box.Elasticity=1.0;

    beha.Physics.Elasticity=1.0;

    beha.Physics.Elasticity=0.9;

    box.behaviors.Elasticity=0.9;

    box.Physics.Elasticity=0.9;

    tried the above iterations of Elasticity , still not working

  • Where are you from? I can get in touch with you. As far as I know, physical documents will not be added until the stable version is released. There is no physical document about.

  • If you get familiar with debugging script, then you can use it to explore APIs before they are documented, as shown here:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)