|
|
Re: progressive alpha
[Re: Marky Mark]
#81554
07/15/06 01:28
07/15/06 01:28
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
skill1 needs to be set to zero at the start. You won't get a divide by zero error because the time variable is being set to this and since it's not zero (unless your frame rate is above 16,384 fps, senselessly high)), you don't get the divide by zero error. Other than this, there shouldn't be any trouble. Keep in mind that the fade-in will be very slow so you'll need to wait a few seconds. Place the object on a background with maximum contrast (e.g. - white on black).
If that doesn't work, try setting the my.skill variable to some test value (I suggest 50,000, enough so it's noticable, for testing purposes only). If it's still not working, make sure the action is assigned to an entity and if you've added the entity through using WED, be sure you have rebuilt your level (especially to update entities).
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: progressive alpha
[Re: ulillillia]
#81555
07/15/06 02:05
07/15/06 02:05
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
I tried all and its still not working... can you try it on a test level? maybe you'll see what's wrong?
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81556
07/15/06 13:02
07/15/06 13:02
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
I think I know. Set my.alpha = 0; at the start. Code:
action super_slow_fadein() { my.skill1 = 0; my.transparent = on; my.alpha = 0; wait(1); // first frame is completely invisible while(my.alpha < 100) { my.skill1 += time; my.alpha = 96000/my.skill1; wait(1); } my.alpha = 100; // full opacity is set only when while loop becomes false }
Another thing to note is whether or not your entity's skin is 32-bit or not. If the entity's skin is 32-bit color, with alpha at 50, it's fully opaque. If your entity's skin is 24 or 16-bit color, you shouldn't have this issue.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: progressive alpha
[Re: ulillillia]
#81557
07/16/06 05:08
07/16/06 05:08
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
hi, Still no results, the entity is staying there totally visible... I decided to returns it to a function, then get an action that tell the entity to be invisible at start. when I press F, the entity appears. Code:
function formation() { my.skill1 = 0; my.transparent = on; my.alpha = 0; wait(1); // first frame is completely invisible while(my.alpha < 100) { my.skill1 += time; my.alpha = 96000/my.skill1; wait(1); } my.alpha = 100; // full opacity is set only when while loop becomes false }
Action formation { my.transparent = on; my.alpha = 0; }
on_f = formation();
I'm getting this error when I press F: 
Last edited by Marky Mark; 07/16/06 05:15.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81558
07/16/06 09:23
07/16/06 09:23
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Code:
function formation() { my.skill1 = 0; my.transparent = on; my.alpha = 0; wait(1); // first frame is completely invisible while(my.alpha < 100) { my.skill1 += time; my.alpha = 96000/my.skill1; wait(1); } my.alpha = 100; // full opacity is set only when while loop becomes false }
Action formation_act { my.transparent = on; my.alpha = 0; while(me) { if(key_f) { while(key_f) { wait(1); } formation(); } wait(1); } }
|
|
|
Re: progressive alpha
[Re: Xarthor]
#81559
07/16/06 15:55
07/16/06 15:55
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
okAY no errors but no fade in... did you tried it? I placed a simple model in front of me when I start to test it...
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81561
07/16/06 16:09
07/16/06 16:09
|
Joined: Jan 2004
Posts: 2,013 The Netherlands
Excessus
Expert
|
Expert
Joined: Jan 2004
Posts: 2,013
The Netherlands
|
Uhm, the math error is pretty obvious.. Code:
while(my.alpha < 100) { my.skill1 += time_frame; my.alpha = (my.skill1/(30*16)) * 100; wait(1); }
Explanation: my.skill1 is the total time the loop has been running in ticks (1 tick = 1/16th of a second). 30*16 is the total time you want this loop to run in ticks. My.skill1/(30*16) gives the factor of how much of the time has been elapsed of the total time(0 when the loop starts, 1 when the loop is finished. We multiply this by the maximum alpha value we want (100..) to get the alpha value.
|
|
|
Re: progressive alpha
[Re: Excessus]
#81562
07/16/06 16:51
07/16/06 16:51
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
its working! i love you guys  Excessus. txs for the explanation too
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81563
07/16/06 17:12
07/16/06 17:12
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
I checked and rechecked it and I don't see any error. Pretend 10 seconds have passed and the the span is 60. The alpha should be 16 2/3 which is 16.667. 10 seconds is 160 ticks. 96000/160 is... 600!? That's why it's not working! It should actually be this instead: my.alpha = my.skill1/960; I wonder why I didn't notice that  . Plus, it's my.skill1 += time, not my.skill1 += time_frame. For 6.40.5 and later, it's my.skill1 += time_step. This is the simpler version of it and it's faster as well than the method directly above.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|