Main Menu
  • Welcome to The RPG Maker Resource Kit.

Glow in the Dark Sprites

Started by cozziekuns, August 01, 2010, 07:25:44 PM

0 Members and 1 Guest are viewing this topic.

cozziekuns

Glow in the Dark Sprites
Version: 1.0
Author: cozziekuns
Date: August 1st, 2010

Version History




  • <Version 1.0> 08.01.2010 - Original Release

Planned Future Versions


  • None. Suggest something.

Description



This script allows for sprites that change their tone depending on the screen tone. Essentially for making glow-in-the-dark sprites, however has a smoother transition from Dark to Bright than other light effect scripts.

Features


  • Sprite tone relative to the screen tone.

Screenshots



Ignore the sloppy HUD.

Instructions

See header.

Script




#===============================================================================

# Cozziekuns Glow in the Dark Sprites
# Last Date Updated: 08/01/2010
#
# This script allows for sprites that change their tone depending on the screen
# tone. Essentially for making Glow in the Dark Sprites, which is tortologius to
# the title.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 08/01/10 - Created Script.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Nothing! Suggest something.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# To make a sprite glow in the dark, just add this comment to an event:
#
# \glow_in_the_dark (CaSe InSenSitIve)
#
# The lag this script will induce depends on the amount you set for your frames.
# The higher the number, the less laggy the script. Each frame lasts for 1/60th
# of as second, so the default (15 frames) refreshes each 1/4 of a second.
# 0 frames would mean that the sprite never refreshes.
#===============================================================================

$imported = {} if $imported == nil
$imported["CozGlowInTheDarkSprites"] = true

module COZZIEKUNS
  module BOKTAI
    module GINDS
      FRAMES = 15 # Amount of frames waited before refreshing the sprites tone.
    end
  end
end

#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :glow_in_the_dark
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias coz_ginds_gc_initialize initialize
  def initialize
    coz_ginds_gc_initialize
    @glow_in_the_dark = false
  end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias coz_ginds_ge_setup setup
  def setup(new_page)
    coz_ginds_ge_setup(new_page)
    unless @page == nil
      i = 0
      comment = ''
      while [108].include?(@page.list[i].code)
        comment += @page.list[i].parameters[0]
        i += 1
      end
      if comment[/\\GLOW_IN_THE_DARK/i] != nil
        @glow_in_the_dark = true
      end
    end
  end
end

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display characters. It observes a instance of the
# Game_Character class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     viewport  : viewport
  #     character : character (Game_Character)
  #--------------------------------------------------------------------------
  alias coz_ginds_sc_initialize initialize
  def initialize(viewport, character = nil)
    @frames = 0
    coz_ginds_sc_initialize(viewport, character)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias coz_boktai_gs_sc_update update
  def update
    coz_boktai_gs_sc_update
    if @character.glow_in_the_dark and @frames == COZZIEKUNS::BOKTAI::GINDS::FRAMES
      self.tone.red = $game_map.screen.tone.red < 0 ? 0 - $game_map.screen.tone.red : 0
      self.tone.blue = $game_map.screen.tone.blue < 0 ? 0 - $game_map.screen.tone.blue : 0
      self.tone.green = $game_map.screen.tone.green < 0 ? 0 - $game_map.screen.tone.green : 0
      @frames = 0
    end
    @frames += 1
  end
end


Credit




  • cozziekuns

Thanks


  • Boktai, great game.

Support



Just post down below.

Known Compatibility Issues

Can't say right now.

Author's Notes



Pinch and a punch for the first day of the month.

Restrictions

:ccby:

Underking

Cool, I always wondered why no-one made this :D Great for time scripts and fires, lamps, ghost, and why not the runes on a giant obelisk?

Fizzly

Nice one. I see this for a lanterns! :)
Regards,
Mike

modern algebra