How can I create 2 or more instances of a single sprite

0 favourites
  • 3 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • Hi, is there any way we can create 2 or more instances of a single sprite in construct 3?

    In the project that I'm working on, I have a platform where the center part is transparent and it moves left and right using “Sine” behaviour. Behind this platform, I have included a thin dotted line so that the player understands how far the platform will be moving.

    To hide this line as the platform moves on top of it, I created a new layer below where the platform is located, moved the thin dotted line sprite to this layer, created a white sprite (mask) in the shape of the platform in this same layer, applied “destination out” for its blend mode, then applied “force own texture” on the layer and finally, “on start of layout”, I create and pinned it to the platform using events.

    As such, if I try to duplicate the main platform, the mask only applies to the first instance. Any thoughts on how I can make/ call other instances of the mask appear if I create more than 1 instance of the main platform? Following are a few screenshots to better explain this.

    I tried looking into other posts that discussed the same problem, but they don't seem to address the issue that I’m trying to solve. Hope someone will be able to guide me on this. Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • From your events, it looks like you dont pick objects before you pin them or set positions into the right platforms so all the masks will be referencing the first platform instance that you have in the layout.

    To link them together (Platform + Mask) you can use Hierarchy or containers.

    For example with Hierarchy:

    On start of Layout:
    
    ---------Destroy (Platform + Mask)
    
    
    ---------Action: create Plattform
    ---------Action: Create Mask at Platform XY
    ---------Action: Platform add Hiearachy Child = "Mask" (XY & Angle)
    
    

    So now they are linked and pinned together, you dont need to use the Pin behaviour.

    And if you ever need to pick (Parent or Child) you can use Hierarchy pick (Parent or Child).

  • Thanks for the update. Before, I never knew things like Hierarchy or containers existed in Construct 3. You have been a lifesaver :)

    sorry for the late reply by the way, for some reason, the community section of the portal was down. I think Scirra just brought it back online.

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