How do I set different Tween times for each instance?

0 favourites
  • 8 posts
From the Asset Store
This music pack covers differents situations for visual novels, anime games and many more!
  • Hi,

    I'm using a tween to ping pong scale and I'm trying to get the speed to vary depending upon an instance variable.

    I'm able to add my Sprite.instancevariable into the Time parameter box but when I execute, the time for that tween is applied to all sprite instances.

    I want it to set a different time for each instance depending on that instance variable.

    Any ideas :(

    Tagged:

  • You can add "For Each Sprite".

  • Hi,

    Thanks for replying.

    I've tried that but it just applies the time value to all sprites being controlled by they tween anyway.

    I'm beginning to think that it's a constraint of Tween that it applies to all sprites.

    I'm going to try setting up a tween for each sprite (with a UUID tag) to get around this.

    Please let me know though if you think I'm missing something.

    Thanks again.

  • Let me just elaborate slightly.

    The tween successfully picks up an instance variable into its time parameter, but it then applies that time value to all sprites being controlled by that tween. I want it to only apply to that one instance of that sprite.

    Basically, I'm asking for a single tween to be concurrently operating with different time intervals for different sprite instances.

  • It works fine for me, even without the "For each".

    dropbox.com/s/oqf4av4n7vjpkti/TweenInstances.c3p

  • Ahh, thats cool. Your example has made me realise that my issue is with how tween scale is working and nothing to do with what I thought.

    If you change your example so that the Tween is Scale, x=2, y=2, ping pong loop and then run it and click a few times you will see the sprites grow out of control. Thats my issue :)

    I just need to turn off the loop and only re-execute the tween after it's finished a cycle (i.e Scale needs to be back to 1 before running again). You, see I need to tween on every tick and they are exploding :) I'm trying to pulsate them but all at different rates based on how old they are (which is my instance variable)

    You are a star, thank you so much for taking away the pain :)

  • I am not sure how I helped, but you are welcome :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    You showed me that it definitely worked and your demo gave me a nice clean object to test out scale tween without all the other noise going on in my own project. Honestly, you've saved me hours and hours of head scratching. You've also reminded me to set up my own mini demos to test stuff out so that lesson will mean I'll save time with other stuff in the future to!!

    Thanks again.

    P.S

    I've made the change in my project now (only re executing a ping pong scale tween at the end of the cycle rather than on every tick) and it's working like a charm.

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