Clone / Copy Objects

Get help using Construct 2

Post » Mon Jun 03, 2013 10:48 am

Hey All,

I was wondering how you would go about cloning an object in construct. A good example would be if I wanted to make a function which made a text shadow. I would add in a family called "TextShadows" and then I would loop through all of the text objects in that family, and "clone" or "copy" that object and change the colour and set the opacity shift it's position and z-index.

That's just an example though, I know there are text shadow plugins out there and so on. I'm jsut trying to give a practical example of something I would like to know how to do for future refence. Another example could be I have a few images I would like to tile across the page. So I would add all the different tiles to group, loop thrugh each of the tiles and then loop through the amount of tiles needed creating each tile individually and spreading them across the screen.

I know you can create an object by using system->create but you have to specify exactly what object you want to create. What I really need to do is to be able to pass it in by code / reference.

I hope this makes sense =) thanks in advance for your help!
Posts: 10
Reputation: 370

Post » Mon Jun 03, 2013 6:02 pm

for each "Text" -> create Textshadow ("Text.x-2","Text.y-2",layer 0 or "background");
so now you create a shadow behind each text element with and offset of 2pixels to let it look natural.

For the buttons the same but a bit more mathimatical. Know how many you want then devide the screen lenght by that amount.

Let's say you want 3 buttons. and the width is 600.
for "button" 1 to 3 -> Create new button(layer0, CanvasWidth-(CanvasWidth/amountOfButtons),CanvasHeight-40*this is so it is not on the complete bottom*). Boom 3 buttons always nice appart.
Posts: 70
Reputation: 1,990

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests