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.

AppGameKit Classic Chat / Fade in/out screen ?

Author
Message
Alain91
12
Years of Service
User Offline
Joined: 20th Aug 2011
Location: France
Posted: 19th Sep 2012 22:00
Hello,

I would like to make fade in/out effect in my code.

I have sprites on the screen, I could use the SetSpriteColorAlpha command on each of them, but do you know another (and easier) method to do this kind of effect ?

By the way is there a kind of "image collections" or "sprite collection" variable in agk ?

Thanks a lot,
alain
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Sep 2012 22:03
I often use a single sprite with no image that covers the whole screen and colour it black. Then just adjust the alpha component of the sprite to fade it in, make sure you have it set to a lower depth than all the sprites you want to hide though...


this.mess = abs(sin(times#))
Alain91
12
Years of Service
User Offline
Joined: 20th Aug 2011
Location: France
Posted: 19th Sep 2012 22:07
Thanks a lot baxslash ! faster than light

And for the "objects collection structure" ? Do you know if there is one ?

Alain
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Sep 2012 22:42
What Baxslash says You can use different colours too, and things like mottled effects. I know it sounds obvious, but it can dramatically change the mood of your game.

There are no object collection commands, unless your objects are physics objects. Then, you can add them to groups and set how they interact with one another.

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 19th Sep 2012 23:17 Edited at: 19th Sep 2012 23:18
It's possible to assign you sprites to a group, and then loop through all the sprites, check to see if they are in the group, and fade them if they are.

But I do the same as baxslash, one full-screen black sprite that covers everything and can be alpha-faded to reveal or conceal.

But it can be more creative than that! Consider a sprite that is twice as tall as the screen, with an image that fades from full transparent to opaque halfway down it's height, then is full opaque for the bottom half. Slide that up over the screen and you have a soft-edged wipe-to-black.

Lots of options...

EDIT: oops, didn't see Bat's post until I'd posted.

Login to post a reply

Server time is: 2024-05-06 20:07:27
Your offset time is: 2024-05-06 20:07:27