Wipe clean a layer

0 favourites
  • 3 posts
  • Is there a way to clear a layer?

    For example; I have a projectile that spawns a trail every millisecond on a specific layer.

    A second projectile can be launched using the first trail as a reference.

    When the second projectile hits a target, the first trail disappears but leaves the second trail up.

    It cycles for third projectile, fourth, fifth, etc.

    Think of the Angry Birds.

    The only thing I can think of is having alternating layers, where they alternatively get wiped clean for re-use.

    Any idea of how to do this? Or am I going about this wrong?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you put a Fade function on the trail so that after a set amount of time it fades out and also check the destroy after fadeout so you dont accumulate artifacts...Try to make sure the trail is withing a Family and apply the fade to the Family instance Behaviors..that way it will be the same for every trail

  • Your alternating layers idea could work, you'd just need a Global Variable to keep track of the layer the trail sprites are spawned on and then you could have an event like this to clear them:


    System->For Each Trail_Sprite

    Trail_Sprite->Is on layer LAYER_VARIABLE





    System->Compare Variable->LAYER_VARIABLE = 1


    System->Set Value->LAYER_VARIABLE = 2



    System->Set Value->LAYER_VARIABLE = 1

    An alternative to using different layers would be to give your trail sprites an alternating instance variable, the event to clear them would be pretty much the same but instead of checking what layer the sprites are on, you'd just check their instance variable

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