Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ranmyzer on Sun 06/11/2005 17:14:43

Title: Dissolve effect to Inventory
Post by: ranmyzer on Sun 06/11/2005 17:14:43
I have the inventory at the bottom of the game screen. Can i add a dissolve (to/from black) video effect to my inventory?
Title: Re: Dissolve effect to Inventory
Post by: Ashen on Sun 06/11/2005 17:44:05
What do you mean, exactly? You want the GUI to fade in/out, or the items (e.g. on mouseover), or what?

You could fade the GUI by having a second, black GUI under it, and chaning the Inventory GUI's transparancy (GUI.Transparency property).

The individual items ... Maybe strazer's InvItemAnimation (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=22888.0) module would help?

Or was it something else again?
Title: Re: Dissolve effect to Inventory
Post by: ranmyzer on Sun 06/11/2005 21:35:08
exactly. when i move the mouse cursor at the bottom of the game screen (an inventory like Black Mirror game.. see the ryoga post for the gamescreen link) i want the gui fade in from the black (black is the background color of my inventory). When i move out the mouse cursor from the inventory i want the GUI fade out.

Title: Re: Dissolve effect to Inventory
Post by: Ashen on Sun 06/11/2005 22:58:58
Try something like:

// in repeatedly_execute
  if (mouse.y > 210) {
    while (trans > 0) {
      trans -= 5;
      Wait(1);
      gIconbar.Transparency = (trans);
    }
  }
  else {
    while (trans < 100) {
      trans += 5;
      Wait(1);
      gIconbar.Transparency = (trans);
    }
  }

Change the mouse.y according to what you need, and the += 5 to vary the speed of the fade. Just make sure, whatever amount you use, trans never goes higher than 100 or lower than 0. (Add a simple check - if (trans > 100) trans = 100;, for example - before setting the Transparency, to be sure.)

As I said you'll need a solid GUI, the same size and position as the Inventory GUI to provide the black. (Just make sure it has a lower z-order, or it'll appear over the Inv GUI.)
If you don't want a black bar always at the bottom of the screen, you can add a bit to the code to turn it off/on as needed.
Title: Re: Dissolve effect to Inventory
Post by: ranmyzer on Wed 09/11/2005 20:20:25
It didn't work... I use the 2.7 version.
Title: Re: Dissolve effect to Inventory
Post by: Ashen on Wed 09/11/2005 20:32:05
So do I, so that shouldn't be a probelm ... let's see ...

What colour depth are you using? Transparency won't work in 256 colour games, so if you're using that you'll have to increase to 16- or 32-bit.

If not ... how is it not working? (What exactly is/isn't it doing?)
Title: Re: Dissolve effect to Inventory
Post by: ranmyzer on Thu 10/11/2005 18:27:21
don't work... like if the code that you have suggested to me does not exist.

I use the best colour deep possible.

can i send you my global script?

tnx
Title: Re: Dissolve effect to Inventory
Post by: Ashen on Thu 10/11/2005 18:34:50
Sure. PM me it, or my e-mail address in in my profile.

Chances are it's something simple - sometimes it just takes a new pair of eyes to see it.
Title: Re: Dissolve effect to Inventory
Post by: ranmyzer on Fri 11/11/2005 18:17:54
This is the link to the entire directory of the game.

http://www.mulaturda.altervista.org/_altervista_ht/Interf_ok.zip


tnx a lot
Title: Re: Dissolve effect to Inventory
Post by: Ashen on Fri 11/11/2005 18:55:53
That link doesn't work for me. It comes up as 'unknown format or damaged'.
Title: Re: Dissolve effect to Inventory
Post by: on Fri 11/11/2005 19:05:56
copy in the navigation bar ;)
Title: Re: Dissolve effect to Inventory
Post by: Ashen on Fri 11/11/2005 19:33:50
OK, couple of things:

Move the line int trans = 100; to the top of the Global script, outside of all functions.

Replace gIconbar with gInventory (i.e. gInventory.Transparency = trans;). I used the Iconbar GUI as it was the right size, and forgot to mention it. In your case, changing the transparency of gIconbar won't make any difference.

Thirdly, and most importantly - you've put the code in show_inventory_window, not in rep_ex as it says to. Move it to rep_ex, and it should work as intended. If you also want the Inventory to appear when you press tab but the mouse isn't at the bottom of the screen, that's going to take a little more work, but is still do-able.

Nice looking art in rooms 2 & 3, by the way.
Title: Re: Dissolve effect to Inventory
Post by: ranmyzer on Sun 13/11/2005 12:05:54
Ok, now work right!

tnx a lot..

we must create a great game :)