Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Changing opacity

In Scene_Map, I've got my window that I created. It all works fine at the moment, but I want to be able to change the opacity of the window with event commands (Using the "Script..." command) at random points. How would I go about doing this?

I've tried Scene_Map.skillz_window.opacity = 0, but it failed immensly.

Thanks.
 

khmp

Sponsor

Well I'm not sure if skillz_window is a public instance variable, a method or you just have a variable called skillz_window so forgive me if the solution I give you doesn't work. If it's a public instance variable meaning it has a "@" in front of it you can make a:
Code:
  attr_accessor :skillz_window
or you can make a method:
Code:
  def skillz_opacity=(opacity)
    @skillz_window.opacity = opacity
  end
In either case both of those require this:
Code:
class Scene_Map
  # Solution you want in here.
end
And then you would insert an empty section right above main and paste the code you want inside there.

Now to invoke that using the "Script..." event command:
Code:
$scene.skillz_window.opacity = n
or using the second solution:
Code:
$scene.skillz_opacity = n
Where n in both cases is the new opacity.

Good luck with it Skyline! :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top