Clone object in code

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi,

    I would like to know if a feature allowing to clone a sprite directly in code was available.

    Or if creating an object with a dynamic name has been introduced.

    I already read from here :

    scirra.com/forum/families-create-specific-object-type_topic48502.html

    It's not possible but this post is from last year.

    Have things evolved ?

    And I also know the trick with creating an sprite containing many different frame but I'm not a fan of this work around.

    Any advices ?

    Thanks

  • You can create sprites during runtime. What is the added benefit of cloning?

    If you'd just like to name the sprite, give it an instance variable name and set it to the name you want so you can call it directly from your eventsheet.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've not been clear enough.

    I'm creating a platform game where the player can visit towns and enter shops to buy items.

    When he enters a building, the interior of the shop appear and the items are displayed. Those items are already in the layout.

    Now my aim is this :

    When the player collided with an item, he can click a button to buy it. When bought, a copy of this item appear near the player.

    The problem is there are many different items and I would like to avoid to create one line of code for each one of them to create a copy of the item purchased.

    Is there a way to clone an object from the layout during an event ?

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