How do I Copy a layout but have new UIDs per object?

Get help using Construct 2

Post » Tue Jan 03, 2017 9:37 pm

If you want to refer by its name, you need a clone.

But. Why would you do that ? Refer by an instance variable.

If you want to refer by name, the amount of events will outrun your live, you will have to re code each event sheet too.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Jan 03, 2017 10:05 pm

@99Instances2Go
How do I clone objects from one layout to a new one ? secondly the goal here is to create a "template" of an original layout and use its design with others. So these layouts are menus , they will all look alike apart from the Menu title,button/sprite labels and what actions are trigged when they are touched/clicked on.
As this is the case, I was trying to simplify the creation of the layouts to speed up creating my project .

I am not sure what you mean by refer to it as an instance variable, it could be that I was not clear with my goal on what I am trying to do so sorry if I have mislead you on this.

The project is mearly for my personal use as I am learning a spoken language and felt that if I put what I am learning into an app/game format it will help me with my progress .
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Tue Jan 03, 2017 11:49 pm

I dont know how to easy clone a complete layout. Maybe by 'hacking' the layout XML's. Might be a case of 'search and replace'. But that is totally out of my league.

Your goal is always producing a code, events, a script, how ever you wanna call it. Excuse me for anticipating on what follows on the cloning.

In my humble eyes is a copy of a layout, and reusing a lot of the code preferable above a clone of the layout and having to recode everything.

If you gonna make templates, my opinion is that you should use families and families only. That way you can very easy replace objects and keep kinda everything in place.

Menu's are a lot easyer to do with 1 Global Layer, another tip.

But hey, i might be wrong, and wayyyyyyyyyyyyyyy of a topic that started with UID's.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Jan 04, 2017 7:50 am

@99Instances2Go Thanks for your input I have currently decided to take the only route I know for now to get this project up and running, if I had more time to work out the methods you have kindly mentioned here I would. The reason for the deadline is that I need to get this self teaching working fast so that I can focus on learning something else as well!

Construct 2 has been a great game maker for me as I have tried many other game makers and found this to be the best.

Oh and I do not think you went that off topic my originaly post was based on trying to get a copied layout to work on its own.

Thanks again 99Instances2Go for your help
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Wed Jan 04, 2017 10:35 am

When you duplicate a layout, you are making copies of the instances of object types that are present in that layout.
So it is natural that renaming an instance of the object type in the duplicated layout ends up renaming the object type in the original layout since it is a single object type all along.

And referring to the name of instances in the event sheet is all fine and one of the strengths of Construct 2.
When using an event sheet applied to a layout, the events only apply to the instances of that layout.
The interest of duplicating layout is to be able to use a common event sheet.

Generally, you will have a "Common" event sheet containing mechanics that are common to all your layouts.
For example, clicking on a button and possibly having a callBack from there.

Then, specific event sheet for each layout will be created (containing the specific callBack for each layout) and including the common event sheet.

At last r241 is a beta release the link of which can be found at the bottom of any page of the website and in this page.

See this example made in r241.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
291
S
114
G
95
Posts: 7,293
Reputation: 70,144

Post » Wed Jan 04, 2017 1:21 pm

Kyatric wrote:When you duplicate a layout, you are making copies of the instances of object types that are present in that layout.
So it is natural that renaming an instance of the object type in the duplicated layout ends up renaming the object type in the original layout since it is a single object type all along.

And referring to the name of instances in the event sheet is all fine and one of the strengths of Construct 2.
When using an event sheet applied to a layout, the events only apply to the instances of that layout.
The interest of duplicating layout is to be able to use a common event sheet.

Generally, you will have a "Common" event sheet containing mechanics that are common to all your layouts.
For example, clicking on a button and possibly having a callBack from there.

Then, specific event sheet for each layout will be created (containing the specific callBack for each layout) and including the common event sheet.

At last r241 is a beta release the link of which can be found at the bottom of any page of the website and in this page.

See this example made in r241.


@Kyatric

Thanks for your detailed reply on this I presume the idea is to have one layout (which is what 99Instances2Go was saying) and then change the behaviour of the buttons etc depending on what they do etc.

However being a little old fashioned for this project only I will probably stick with what I am doing.

Thanks for the link to the beta release and the link for the example
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Previous

Return to How do I....?

Who is online

Users browsing this forum: ditocruz, RalleRoyal and 35 guests