How do I copy one instance to another?

Just started using Construct 2? Post your questions here

Post » Wed Nov 12, 2014 1:41 am

Hello;

If I have two instances of the same object how do I copy one to another? I don't want to create a new instance, just copy some
variables from one to the other. I can't say instTwo.val1=instOne.val1 since as soon as I have an instance of an object the old one (from the same object) I had is lost to the event since the first one takes its place. Do I make local temp variables and save instOne.val1 to temp1, then get instTwo and set instTwo,val1=temp1. That seems convoluted. Is there a better way?


Thanks for your time.
B
34
S
8
G
3
Posts: 169
Reputation: 3,305

Post » Wed Nov 12, 2014 1:57 am

Sprite(0).Variable = Sprite(1).Variable -> do something

But it depends on what you want to do. You can put Sprite into a family "SprFam" and then do ckecks like Sprite.variable=SprFam.variable.
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest