Jump to content

Tween not working with present update function


robeeeert
 Share

Recommended Posts

Hi everyone,

 

I'm developing a simple game where objects visually approach the screen and you have to click on them before they visually reach the screen.

However, I was getting mad when trying to add tweening to the sprites representing the approaching objects. They should fade out and in when hit to give a visual feedback to the player that they've been hit.

 

I tested tweens in an extra stage and everything worked fine, so I adapted those three lines of code to the hit callback in the gameplay stage of the game. The tween wouldn't start at all. Before the first time the tween's start function was invoked, its startTime attribute was set to null, after that it changed to 0, but visually, nothing happened. So I wondered if I missed something, commented out all the stuff that could interfere like the content of the update function, where the scale of each approaching object is adjusted and so on. In the end, I had an object with a hit function, a click callback and a sprite, still standing. And still - nothing happened.

So just before I wrote this post right here, I tried commenting out the whole update function, including its declaration, from the stage and voilà. The tween works like a charm.

 

So to sum up, tweening a sprite doesn't work when an update function is present in the stage to which the sprite belongs.

 

Is this behaviour intended? Is it to fix in a coming release? What is the best practice so far?

 

Greetings,

Roberto

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...