Dissolve effect to Inventory

Started by ranmyzer, Sun 06/11/2005 17:14:43

Previous topic - Next topic

ranmyzer

I have the inventory at the bottom of the game screen. Can i add a dissolve (to/from black) video effect to my inventory?

Ashen

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 module would help?

Or was it something else again?
I know what you're thinking ... Don't think that.

ranmyzer

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.


Ashen

Try something like:
Code: ags

// 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.
I know what you're thinking ... Don't think that.

ranmyzer

It didn't work... I use the 2.7 version.

Ashen

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?)
I know what you're thinking ... Don't think that.

ranmyzer

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

Ashen

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.
I know what you're thinking ... Don't think that.


Ashen

That link doesn't work for me. It comes up as 'unknown format or damaged'.
I know what you're thinking ... Don't think that.

Ryoga


Ashen

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.
I know what you're thinking ... Don't think that.

ranmyzer

Ok, now work right!

tnx a lot..

we must create a great game :)



SMF spam blocked by CleanTalk