Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (Martin_HH, steyr, alibaba), 509 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
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 Offline
Senior Expert
ulillillia  Offline
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 Offline OP
User
Marky Mark  Offline 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 Offline
Senior Expert
ulillillia  Offline
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 Offline OP
User
Marky Mark  Offline 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 Offline
Expert
Xarthor  Offline
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 Offline OP
User
Marky Mark  Offline 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] #81560
07/16/06 16:03
07/16/06 16:03
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline OP
User

Joined: Jul 2002
Posts: 857
Québec
Quote:

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...




ok I just made an error... now at start its invisible and when I press F, it appears, but not progressivly.we're on the good way


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
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

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 Offline OP
User
Marky Mark  Offline 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 Offline
Senior Expert
ulillillia  Offline
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
Page 2 of 3 1 2 3

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1