Duplicate an instance

0 favourites
  • 7 posts
  • So I have an instance that has many animation frames. Lets say 100. The instances animation frame is picked by random. I need to mirror this instance.

    Imagine a barbell - if you randomly pick a 20 lb weight for the left side you want to put a 20 lb weight on the right side. Is is possible to do this without making a copy of all the frames for the second weight? Reason being It would be good to edit just one set of animation frames and not have to think about all its duplicates when changes are made. Also imaging displaying 10 instances of the barbell at once.


  • Hey greenleafvt

    I dont know exactly where your problem lies. Copying, mirroring and linking an instance to the first one should not be too much of a hurdle. Have you already tried and created a few events, so you can show us what exactly you are trying to do? Are all your weights already on the layout or do you want to spawn them via trigger? How do you want to use your objects after they have been created?

    Maybe this will help you a little bit:


  • Hi kriand,

    Getting weird results but maybe its from not being able to put RndFrame in the Set Animation command.

    If you get a chance maybe look it over for me.



  • The group 'Charms' hinders the charms from changing the animation, because it change the animation back immediately. Also your did not change the code to chose an animation instead of a frame. If you dont need frames for your animations, i can sometimes be easier to put all images into one animation and turn its speed to 0, like in my example.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Kriand,

    The frames work much better then all the separate animations. However I have a question for you. I need to make many instantiations of this object grouping. If I just copy and paste the instance I get some weird interaction between the instances. Example changing the color value of the piece by clicking on it changes not only the piece you are on but the other instantiation as well. When I put the object sprites into a container everything works great. No crossover problems at all. But The problem lies in the other places I want to use the "charms" - These other places need only one "charm" loaded but now it thinks it needs to load all the container items. Can you point me in the right direction to handle this?

    Example attached - See that the "bars" work fine in the container but now the "post" tab items are getting effected by the container as well. What would be the best practice here to get around this problem?


  • This problem occurs because you dont define which instances you want to pick, so all instances change their color:

    First: You change the animation for all charm_multiply2 with charm1=15 and for ALL (no exception) charm_color2.

    Second: When a charm_color has color=1, ALL charm_color2 change their color.

    I deleted the container and on the layout I assigned the charms to the appropriate groups (via instance variable 'Group_ID'). Also i improved the events under the "CHARM" group (i hope without bugs ;).


  • Ok.yeah I see the value behind the Group_ID variable now. The container function was how I was able to get around this problem at first but the variable seems like a much better way of handling it. Guessing I need to move into arrays in the end as I need some way of passing the randomly generated image to a edit Page (Another Layout)

    and/or I'm thinking the best practice would be to have a function making the random value - then sending the random value to the variable. As apposed to having the variable instance frame or color be a random itself.

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