Clone / Copy Objects

0 favourites
  • 2 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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