Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, dr_panther, VoroneTZ), 793 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A fade effect - [SOLVED] #426132
07/17/13 02:59
07/17/13 02:59
Joined: Jul 2013
Posts: 66
Don't have a one...
D
DonaldThief Offline OP
Junior Member
DonaldThief  Offline OP
Junior Member
D

Joined: Jul 2013
Posts: 66
Don't have a one...
Hi, guys

I read some AUMs and everything worked fine until I came to the section talking about fade effect (actually, I couldn't understand anything). So, I'd like anyone to share his knowledge and tell me how to make fading in & out effect

Also, if any of you guys know some tutorial for particles (fire, explosion, smoke ...etc.) it will be better if he/she shares it

Thank you for reading

Last edited by DonaldThief; 07/17/13 14:16.
Re: A fade effect [Re: DonaldThief] #426134
07/17/13 05:14
07/17/13 05:14
Joined: Feb 2010
Posts: 886
Random Offline
User
Random  Offline
User

Joined: Feb 2010
Posts: 886
Easy fade script from the manual.

Code:
set(my,TRANSLUCENT);for (my.alpha=0; my.alpha+=5*time_step; my.alpha<100) wait(1);
reset(my,TRANSLUCENT);



The manual is a great place to look ^^



Re: A fade effect [Re: DonaldThief] #426137
07/17/13 05:56
07/17/13 05:56
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
BMAP* bmpSpark = "spark.bmp";


function effectBloodSplatFade(PARTICLE* p)
{
p.size -= (.25+random(.25)) * time_step; // reduce blood splats size with some randomness
p.alpha-=4*time_step; // fade out bloodsplat
p.lifespan = maxv(0,p.alpha); // when alpha reaches <= 0, lifespan = 0, thus ending that particular bloodsplat particle
}

function effectBloodSplat(PARTICLE* p)
{

vec_set(p.vel_x,vector((random(2)-1),(random(2)-1),(.5-random(1)))); // give a little random velocity to each bloodsplat particle

//give a little random start position to each bloodsplat
p.x += random(3)-1.5;
p.y += random(3)-1.5;
p.z += random(3)-1.5;
p.bmap = bmpSpark;
set(p,STREAK|BRIGHT|MOVE); // set particle parameters
p.size=4+random(8); // give each bloodsplat a little random size
p.alpha = 70 + random(15); // give each bloodsplat a little random alpha(visiblilty)

p.gravity = 0.3; // make particles fall down with gravity, not necessary for some effects

//give each bloodsplat a little random red color
p.red = 200 + random(55);
p.green= 20 + random(10);
p.blue = 20 + random(10);

p.event = effectBloodSplatFade; // call the fade event
}

// Somewhere in code that calls effect
...
effect_local(effectBloodSplat,(2+random(4)),my.x,nullvector); // create 2 to 6 blood splats at entity position
...

About as simple as it gets, except for the randomness stuff,
That's all I got for you, hope it helps,
Later,
Loco


Professional A8.30
Spoils of War - East Coast Games
Re: A fade effect [Re: Locoweed] #426156
07/17/13 11:54
07/17/13 11:54
Joined: Jul 2013
Posts: 66
Don't have a one...
D
DonaldThief Offline OP
Junior Member
DonaldThief  Offline OP
Junior Member
D

Joined: Jul 2013
Posts: 66
Don't have a one...
@Locoweed thank you for helping

@Random Thank you but this is not what I want. I don't want an entity to fade in and out ,I want the whole screen (e.g. a white flash that increases ,and when reaching some maximum ,it decreases gradually)

Re: A fade effect [Re: DonaldThief] #426158
07/17/13 12:18
07/17/13 12:18
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
To fade the whole screen white/black whatever u can use panels of course.
Code:
BMAP* white_map = "white.pcx"; // a solid white 64x64 image
PANEL* white_pan ={
   alpha = 0;
   bmap  = white_map;
   flags = TRANSLUCENT;
}
void _fade_white_inandout(){
   if (is(white_pan, SHOW)) return;
   set (white_pan, SHOW);
   white_pan.alpha = 0;
   white_pan.scale_x = screen_size.x;
   white_pan.scale_y = screen_size.y;
   while (white_pan.alpha < 100){
      white_pan.alpha += time_step * 2;
      wait (1);
   }
   while (white_pan.alpha > 0){
      white_pan.alpha -= time_step * 2;
      wait (1);
   }   
   reset (white_pan, SHOW);
}

Greets


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: A fade effect [Re: rayp] #426173
07/17/13 14:07
07/17/13 14:07
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Code:
white_pan.scale_x = screen_size.x

I guess this is not your intention. You meant
Code:
white_pan.size_x = screen_size.x

right?


Always learn from history, to be sure you make the same mistakes again...
Re: A fade effect [Re: Uhrwerk] #426176
07/17/13 14:15
07/17/13 14:15
Joined: Jul 2013
Posts: 66
Don't have a one...
D
DonaldThief Offline OP
Junior Member
DonaldThief  Offline OP
Junior Member
D

Joined: Jul 2013
Posts: 66
Don't have a one...
@rayp Thank you very much

Re: A fade effect [Re: DonaldThief] #426178
07/17/13 14:41
07/17/13 14:41
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
@Uhrwerk
Yeah wrote it on the fly...your right of course ^^
thanks


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: A fade effect [Re: DonaldThief] #426274
07/19/13 03:05
07/19/13 03:05
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Ah, whole screen, glad you got it figured out.

Later,
Loco


Professional A8.30
Spoils of War - East Coast Games

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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