Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 29th Oct 2016 19:14
Hi,
Please take a look at the following snippet


what is the proper behavior of the following command:

Why the 'begin' variable does not equal to 1000 after the following code:
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Oct 2016 22:54
The initial value doesn't get set until you play the tween.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Oct 2016 02:31
Why not immediately?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Oct 2016 08:34 Edited at: 30th Oct 2016 08:34
In the first step, you have described how you want the tween to behave. but it doesn't actually breathe life until you play it.

I would code it "back to front". I would set the begin variable to 1000, and then set the tween start value to begin.
This solves the immediate problem.
Also, when you look back at your code in 6 months time it will make sense without having to write a paragraph of comments in your code.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Oct 2016 13:48 Edited at: 30th Oct 2016 14:02
Your suggestion does not solve the following scenario:
I have a sprite and I want to tween its CURRENT color alpha to another value (lets say to 0.0)
Take a look at the following snippet:

the sprite will not be visible until the tween starts. In our case it will be visible after 3.0 seconds
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Oct 2016 14:07
A couple of thoughts...

Remove line 13. alpha_begin already has the correct value, you are setting it to an incorrect value of 0 because the tween isn't playing yet.
Line 21/22 should be:



And thirdly, you could simplify by using CreateTweenSprite and SetTweenSpriteAlpha.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Oct 2016 15:08 Edited at: 30th Oct 2016 16:37
Thanks for the tip. But your suggestion adds an 'if' statement in the loop.
Having the value set at the beginning then we have an 'if' less.
[EDIT]
Could you please post the whole snippet?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Oct 2016 20:33
You need the if statement otherwise you will get the tween value when the tween is not playing, it will be zero and the sprite will turn invisible. The if statement ensures that you only process the fade when the poiner has been clicked.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-09-29 19:16:21
Your offset time is: 2024-09-29 19:16:21