So, recently I was playing through a friends project demo and I noticed he was using the 'classic' Khas 'Awesome' Light Effects.
Now, The Khas script does boast some excellent features; coupled with the fact it is now free for commercial games tempted me to insert it into my own project.
Shortly after inserting the script, once I had continued development of my own project, I noticed some severe lag issues occurring. Immediately, I assumed that this was due to the small script I wrote to show a lantern (like, in the players hand) by using a simple script call...
To give you idea how this looks...
After turning off my simply little lantern graphic script, I realized that the lag was actually being caused by Khas light script. Even though my map is 'tiny' (24x26) with only one light source on it (the players lantern)
So, this gave me the motivation to write my own 'simple' lighting script.
The features I need are fairly simple as it is only to add a little detail when in caves, and to make use of my 'show lantern' script mentioned previously.
Anyway...
I seem to have 'hit a snag' that I cant quite put my finger on.
I wrote a little snippet to simply create a layer of 'darkness' and another to create a 'light'. I was using the light images found in khas awesome light demo (as i figured they would work too)
Now, when I create both images, I cant seem to get the 'light' to 'override' the 'darkness'
It looks like this...
As you can see, my 'light' is simply shown above the darkness layer. Additionally, it does not look 'light' in any sense of the term..
My first thought was to simply 'invert' the light image... So I did...
As you can see, it is still not looking right at all..
I have tried adjusting the 'blend_type' to various values for both the darkness and the light.
I have tried other various things I could think of, such as setting the color.alpha to high/low values, tried turning opacity / visibility on/off etc. and It just doesn't seem to want to show my images correctly..
For the meantime (until I can resolve this issue) I have resorted to a 'pokemon - flash' style light
As you can see, this is also not ideal; therefore, I would greatly appreciate any help anyone may have into this issue.
For your perusal, I have included my script in this final spoiler ^_^
This script will autorun when you insert it into your project. You must ensure that you have a folder called Lights within the graphics folder and the image "light_s" from Khas' awsome lights demo, which can be found HERE.
So, if anyone can shed some light onto this dull situation it would enlighten my mood substantially ^_^
Also, if you need any more info / have questions, feel free to let me know 🙂
Now, The Khas script does boast some excellent features; coupled with the fact it is now free for commercial games tempted me to insert it into my own project.
Shortly after inserting the script, once I had continued development of my own project, I noticed some severe lag issues occurring. Immediately, I assumed that this was due to the small script I wrote to show a lantern (like, in the players hand) by using a simple script call...
To give you idea how this looks...
So, this gave me the motivation to write my own 'simple' lighting script.
The features I need are fairly simple as it is only to add a little detail when in caves, and to make use of my 'show lantern' script mentioned previously.
Anyway...
I seem to have 'hit a snag' that I cant quite put my finger on.
I wrote a little snippet to simply create a layer of 'darkness' and another to create a 'light'. I was using the light images found in khas awesome light demo (as i figured they would work too)
Now, when I create both images, I cant seem to get the 'light' to 'override' the 'darkness'
It looks like this...
My first thought was to simply 'invert' the light image... So I did...
I have tried adjusting the 'blend_type' to various values for both the darkness and the light.
I have tried other various things I could think of, such as setting the color.alpha to high/low values, tried turning opacity / visibility on/off etc. and It just doesn't seem to want to show my images correctly..
For the meantime (until I can resolve this issue) I have resorted to a 'pokemon - flash' style light
For your perusal, I have included my script in this final spoiler ^_^
if true # << Make true to use this script, false to disable.#===============================================================================module Easy_Lights#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- Folder = "Graphics/Lights/" ##################### # CUSTOMISATION END #end ######################===============================================================================module Cache#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def self.lights(filename, hue = 0) load_bitmap(Easy_Lights::Folder, filename, hue) endend#===============================================================================class Sprite_Darkness < Sprite#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def initialize(viewport) super(viewport) gw = Graphics.width gh = Graphics.height co = Color.new(0,0,0,200) self.bitmap = Bitmap.new(gw,gh) self.bitmap.fill_rect(0,0,gw,gh,co) self.visible = true self.blend_type = 0 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def dispose super end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def update super endend#===============================================================================class Sprite_Lights < Sprite#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def initialize(viewport,image) super(viewport) self.bitmap = Cache.lights(image) self.blend_type = 0 self.ox = (self.bitmap.width/2) self.oy = (self.bitmap.height/2)+12 self.visible = true# self.color.alpha = 255 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def dispose super end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def update super endend#===============================================================================class Spriteset_Map#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- alias :init_ezaylight :initialize alias :disp_ezaylight :dispose alias :updt_ezaylight :update #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def initialize init_ezaylight init_darkness init_lights end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def dispose disp_ezaylight disp_darkness disp_lights end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def update updt_ezaylight updt_darkness updt_lights end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def init_darkness @darkness = Sprite_Darkness.new(@viewport2) updt_darkness end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def disp_darkness return unless @darkness @darkness.dispose @darkness = nil end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def updt_darkness return unless @darkness @darkness.update @darkness.z = $game_player.screen_z-1 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def init_lights @lights = Sprite_Lights.new(@viewport2,"light_s") updt_lights end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def disp_lights return unless @lights @lights.dispose @lights = nil end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def updt_lights return unless @lights @lights.update @lights.x = $game_player.screen_x @lights.y = $game_player.screen_y @lights.z = $game_player.screen_z-1 end end#==============================================================================## http://dekitarpg.wordpress.com/ ##==============================================================================#end # if true # << Make true to use this script, false to disable.
So, if anyone can shed some light onto this dull situation it would enlighten my mood substantially ^_^
Also, if you need any more info / have questions, feel free to let me know 🙂