edit instance of runtime placed sprite

0 favourites
  • 9 posts
From the Asset Store
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • i make sprite in project,but not place it on layer at editor.add to this sprite two instance variables.

    till it not placed on layer-i can't edit variables.

    place sprite on layout runtime

    runtime.objects["Card_15"].createInstance("Layer 0","100","100");
    

    after that i try edit variables like this

    runtime.objects["Card_15"].getFirstInstance().instVars["pushed"]=false;
    runtime.objects["Card_15"].getFirstInstance().instVars["suit"]=1;
    

    but as i see in debug mode it take no luck.what i doing wrong?

  • up time

  • It's much easier to help if you share your project. Otherwise we can only guess.

    It looks like you're incorrectly passing strings instead of numbers for the position in createInstance(), so I would guess that is the problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • here is the cut of project,with the problem.if i leave this two row here

    runtime.objects["Card_15"].getFirstInstance().instVars["pushed"]=true;
    runtime.objects["Card_15"].getFirstInstance().instVars["suit"]=1;

    the card doesn't move on click.if i cut off it-card move as should be.so the bug in that two rows,but what exactly?

    dropmefiles.com/aauAh

  • it's still actual for me

  • so,i found something

    if i write

    runtime.objects["Card_15"].createInstance("Layer 0","100","100");
    const aaa = runtime.objects["Card_15"].getAllInstances(); 
    console.log(aaa);

    i got this result

    but if i leave just

    runtime.objects["Card_15"].createInstance("Layer 0","100","100");
    

    and put this on button on click event-i got this one

    const aaa = runtime.objects["Card_15"].getAllInstances(); 
    console.log(aaa);

    and after this i can get variables.so i conclude that the object does not have time to be created before accessing the variables.i don't know how to fix it,for now i just place all sprites on unviewed place of layout at editor.i don't like this solution,but atleast it's work.

  • I recommend using a dummy layout where you place a single instance of every object. That layout will never be used in runtime, but you can use it in the editor to edit default values of instance variables for example.

    I find that Construct usually dislikes and/or behave strangely when using objects that have 0 instance at edit time.

  • I find that Construct usually dislikes and/or behave strangely when using objects that have 0 instance at edit time.

    true story

    and how to use that's objects?some like runtime copy to layout?

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