andersaloof Posted January 7, 2014 Share Posted January 7, 2014 Hi, I'm currently making my first game, a math puzzle game in a hexagonal layout, and have a question regarding tweens. I'm trying to flip one of my hexagonal sprites, and it works fine using a tween and setting the scale.y of the sprite to scale.y * -1 as the destination tween value. However, I want to change my sprite texture halfway, giving the illusion of a backside of the tile. Is there a way to get a callback that could do a sprite.loadTexture('backside') when 50% of the tween has played? I've kinda solved it using two tweens, the first tweening scale.y to 0, and the next tweening scale.y to the flipped value, but I would think a callback at x percent of the tweens time/value would be prettier and more manageable. BTW, thanks for a great framework!So far I'm super impressed and really like the examples and docs, but would be nice if the Classes list would be alphabetically sorted Link to comment Share on other sites More sharing options...
rich Posted January 7, 2014 Share Posted January 7, 2014 I'm afraid there is no way to run a callback mid-way through a tween, so I would go with your current solution of using a chained tween and changing it between one ending and the other starting. If possible try and find a way to do it without using loadTexture too, i.e. maybe putting all the card frames into a texture atlas + the card back, then just changing the sprite frame at the mid-point instead. It will be much cleaner in the long run imho. Link to comment Share on other sites More sharing options...
andersaloof Posted January 8, 2014 Author Share Posted January 8, 2014 Thanks for the quick reply. I reworked my two tweens solution so it's neater. I'll also use a sprite atlas, just getting into things and haven't set that up yet, only used a couple of sprites so far for testing... Link to comment Share on other sites More sharing options...
Recommended Posts