05-14-2017, 06:25 PM 
(This post was last modified: 05-15-2017, 02:46 PM by LiTTleDRAgo.)
	
	
	
		Just want to share...
I edited this script so it will load windowskin arrows if no arrow images in Graphics/Pictures.
![[Image: lilERLXs.png]](http://i.imgur.com/lilERLXs.png)
http://i.imgur.com/lilERLX.png
  			
		
Also..... VX ACE version :
  			
		
	
	
	
	I edited this script so it will load windowskin arrows if no arrow images in Graphics/Pictures.
![[Image: lilERLXs.png]](http://i.imgur.com/lilERLXs.png)
http://i.imgur.com/lilERLX.png
 SLOLS XP
  			Code:
#==============================================================================
# ** Snake Look-alike on Loading Script
#------------------------------------------------------------------------------
# Zeriab
# v 1.0
# 28-09-2006
#==============================================================================
class Scene_SLOLS
  # The variable the number of dots collected will be stored
  Cheese_Variable = 25
  # The size of the margin in pixels
  Margin = 10
  # The thickness of the border in pixels
  Border_Thickness = 3
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(scene=Scene_Map.new)
    @next_scene = scene
  end
  
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Creates Bar Window (Loading bar)
    @bar_window = Window_SLOLS_Bar.new
    # Creates Info Window
    info = [Margin, Border_Thickness, Cheese_Variable]
    @info_window = Window_SLOLS_Info.new(*info)
    # Creates Game Window
    @game_window = Window_SLOLS_Game.new(*info)
    # Execute transition
    Graphics.transition
    # Scene Objects
    @scene_objects = [@bar_window, @info_window, @game_window]
    # Main loop
    while $scene == self
      # Sleeps a short while to let the other thread work.
      sleep(0.01)
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      ## Frame update
      update
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose Scene Objects
    @scene_objects.each { |x| x.dispose }
  end  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
      # Updates Scene Objects
      @scene_objects.each { |x| x.update }
      # If B or C Button Is Pressed
      if Input.trigger?(Input::B) || Input.trigger?(Input::C)
        # If the loading thread is finished (not alive)
        if !$loader.is_a?(Thread) || !$loader.alive?
          # Play Decision SE
          $game_system.se_play($data_system.decision_se)
          # Switch to map screen
          $scene = @next_scene
          return
        else
          # Play Buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end
  end
end
#==============================================================================
# ** Window_SLOLS_Info
#==============================================================================
class Window_SLOLS_Info
  # Instructions
  Instructs = [
                'Navigate using the','arrow keys.',
                'Collect green dots.',
                'This is done by','going into them.',
                'A sound will play','when the loading','is finished',
                '','Enter to continue'
             ]
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(margin, border_thickness, cheese_variable)
    # The name of the arrow images
    @arrow_file_names = ["Down_Arrow.png", "Left_Arrow.png",
                         "Right_Arrow.png", "Up_Arrow.png"]
    # The windowskin images
    @windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
    # The arrow images
    @arrow_images = []
    for i in 0..3
      # Makes sure that the program keeps running if one or more of the files
      # given don't exists. (read: wrong filename or missing file)
      begin
        # Reads the bitmap
        bitmap = Bitmap.new('Graphics\\Pictures\\'+@arrow_file_names[i])
      rescue Exception => ex
        # Creates a blank 32x32 bitmap and Blt windowskin arrows if the 
        # reading fails
        bitmap = Bitmap.new(32,32)
        # Arrow down
        bitmap.blt(0,0,@windowskin,Rect.new(128,128,32,-32))if [0,1].include?(i)
        # Arrow up
        bitmap.blt(0,0,@windowskin,Rect.new(128,96,32,32))  if [3,2].include?(i)
        # Arrow left or Arrow right
        if [1,2].include?(i)
          # Clone the Arrow
          copy = bitmap.clone       
          # Rotate 90 degrees clockwise
          32.times do |j|
            32.times {|k| bitmap.set_pixel(32-j-1,k, copy.get_pixel(k, j))}
          end 
          # Dispose clone
          copy.dispose
        end
        # Prints the exception if in Debug mode.
        if $DEBUG
          p ex
        end
      rescue Exception => ex
        # Creates a blank 32x32 bitmap if the reading fails
        bitmap = Bitmap.new(32,32)
        # Prints the exception if in Debug mode.
        if $DEBUG
          p ex
        end
      end
      # Pushes the resulting bitmap into the array
      @arrow_images.push(bitmap)
    end
    # Dispose windowskin
    @windowskin.dispose
    # The margin and border thickness
    @margin = margin
    @border_thickness = border_thickness
    @cheese_variable = cheese_variable
    
    # Height with border excluding margin
    @height = 416-@margin
    
    # The instructions Sprite
    @instru = Sprite.new(Viewport.new(480 + @border_thickness,
                        48 + @border_thickness,
                        159 - @margin - @border_thickness*2,
                        282 - @margin*4 + 4))
    @instru.bitmap = Bitmap.new(159 - @margin - @border_thickness*2,
                               282 - @margin*4 + 4)
    @instru.bitmap.font.color = Color.new(225, 225, 225, 255)
    @instru.bitmap.font.size = 20
    
    
    # The main Sprite
    @contents = Sprite.new(Viewport.new(480, 0, 160, @height))
    @contents.bitmap = Bitmap.new(160, @height)
    @contents.bitmap.font.color = Color.new(225, 225, 225, 255)
    @contents.bitmap.font.size = 22
    refresh
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Simplifying the variables used
    border = @border_thickness
    spacing = @margin + border
    
    # Removes any old contents, garbage and so on.
    @contents.bitmap.clear
    # Draws the white block used for the border of the score
    @contents.bitmap.fill_rect(0,@margin,159-@margin,22+border*2,
                                Color.new(225, 225, 225, 255))
    # Draws the white block used for the border of the instructions
    @contents.bitmap.fill_rect(0,48,159-@margin,282+border*2-@margin*4+4,
                                Color.new(225, 225, 225, 255))
    # Draws a black block on the white block creating the border.
    @contents.bitmap.fill_rect(border, 48+border,159-spacing-border,
                               282-@margin*4+4, Color.new(0, 0, 0, 0))
    
    # Draws the left arrow
    @contents.bitmap.blt(0,373-@margin,@arrow_images[1],Rect.new(0,0,43,43))
    # Draws the down arrow
    @contents.bitmap.blt(43+@margin,373-@margin,@arrow_images[0],
                         Rect.new(0,0,43,43))
    # Draws the right arrow
    @contents.bitmap.blt(43*2+@margin*2,373-@margin,@arrow_images[2],
                         Rect.new(0,0,43,43))
    # Draws the up arrow
    @contents.bitmap.blt(43+@margin,330-@margin*2,@arrow_images[3],
                         Rect.new(0,0,43,43))
    
    # Draws the text 'Instructions:'
    @contents.bitmap.draw_text(border, 48, 150-border*2, 22, 'Instructions',1)
    
    # Draws the intructions
    for i in 0...Instructs.size
      # Gets the string
      str = Instructs[i]
      # Draws the string
      @instru.bitmap.draw_text(2, 22*(i+1), 150-border*2, 20, str,1)
    end
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    # Simplifying the variables used
    border = @border_thickness
    spacing = @margin + border
    # Updates the sprite
    @contents.update
    # Removes old contents
    @contents.bitmap.fill_rect(border, spacing, 159-spacing-border, 22,
                               Color.new(0, 0, 0, 0))
    # Draws the amount of dots collected
    @contents.bitmap.draw_text(border, spacing, 153-spacing, 22,
                               $game_variables[@cheese_variable].to_s, 2)
    # Draws the text 'Dots:'
    @contents.bitmap.draw_text(border+2, spacing, 157-spacing, 22, 'Dots:')
  end
  
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @contents.bitmap.dispose
    @contents.dispose
  end
end
#==============================================================================
# ** Window_SLOLS_Game
#==============================================================================
class Window_SLOLS_Game
  #Player Settings
  Size = 5
  Default_Speed = 3
  Trail_Length = 19
  
  #Cheese Settings
  Cheese_Size = 3
  Cheese_Colors = [Color.new(10,200,20,255)]
  Max_Cheese_Amount = 200
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(margin, border_thickness, cheese_variable)
    # The margin and border thickness
    @margin = margin
    @border_thickness = border_thickness
    @cheese_variable = cheese_variable
    
    # Width of the playing field
    @width = 480-(@margin*2) - (@border_thickness*2)
    # Height of the playing field
    @height = 416-(@margin*2) - (@border_thickness*2)
    
    # Player info
    @player_x = 200
    @player_y = 208
    @player_trail = []
    @player_dir = 6   #2 - up, 4 - left, 6 - right, 8 - down
    @speed = Default_Speed
    
    # The cheese array
    @cheese = []
    @cheese.push(make_cheese)
    # The amount of cheese caught during this season.
    @cheese_amount = 0
    
    # Create the Sprite for viewing the border
    view = @margin, @margin, 480-@margin, 416-@margin
    @border = Sprite.new(Viewport.new(*view))
    @border.bitmap = Bitmap.new(480-(@margin*2),416-(@margin*2))
    
    # Creates the main Sprite
    @contents = Sprite.new(Viewport.new(@margin + @border_thickness,
                                @margin + @border_thickness, @width, @height))
    @contents.bitmap = Bitmap.new(@width,@height)
    # Refreshes
    refresh
    # Updates
    update
  end
  
  #--------------------------------------------------------------------------
  # * Make Cheese
  # ---------------------
  # Generates a pointer to a place where a cheese will be at least 3 pixels
  # away from the player
  #--------------------------------------------------------------------------
  def make_cheese
    result = []
    # Total size. (Sum of player size and cheese size)
    size = Size + Cheese_Size
    
    loop do
      # Generating the x and y coordinates
      x = rand(@width - (size + 5)*2)
      y = rand(@height - (size + 5)*2)
      
      # Adjusts the x and y coordinates so the cheese will not be
      # placed in the player
      x += 2*(Size + 5) if x > @width / 2 - (size + 5)
      y += 2*(Size + 5) if y > @height / 2 - (size + 5)
      
      # Makes sure that no cheese exists in that exact same place
      # Does not consider the size of the cheese.
      if !@cheese.include?([x,y])
        result = [x,y]
        break
      end
    end
    
    return result
  end
  
  #--------------------------------------------------------------------------
  # * Check Player
  # --------------------
  # Checks if the player have caught a cheese. (Is touching one)
  # Returns the indices of the cheese in an array
  #--------------------------------------------------------------------------
  def check_player
    result = []
    # Checks every cheese
    for i in 0...@cheese.size
      # Distance in the x-plane
      d = (@cheese[i][0] - @player_x).abs
      # Distance in the y-plane
      d_y = (@cheese[i][1] - @player_y).abs
      # Makes 'd' contain the largest distance
      d = d_y if d < d_y
      
      # If the largest distance is less than the size of the player and the
      # cheese the player must be touching the cheese.
      result.push(i) if d < (Size + Cheese_Size - 1)
    end
    return result
  end
  
  #--------------------------------------------------------------------------
  # * Draw Cheese
  #     i     : The index on the cheese
  #     color : The color wanted for the cheese
  # --------------------
  # Draws the designated cheese with the given color
  #--------------------------------------------------------------------------
  def draw_cheese(i, color)
    cheese = @cheese[i]
    size = Cheese_Size
    # Draws the cheese
    @contents.bitmap.fill_rect(cheese[0]-(size-1),cheese[1]-(size-1),
                            (size*2)-1, (size*2)-1, color)
  end
  
  #--------------------------------------------------------------------------
  # * Delete Cheese
  #     i : The index on the cheese
  # --------------------
  # Deletes the cheese by first drawing it black and then removing the cheese
  # from @cheese.
  #--------------------------------------------------------------------------
  def delete_cheese(i)
    draw_cheese(i, Color.new(0,0,0,0))
    @cheese.delete_at(i)
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @border.bitmap.clear
    # Draws a white block
    @border.bitmap.fill_rect(0,0,480-@margin, 416-@margin,
                  Color.new(225, 225, 225, 255))
    # Draws a smaller black block to give the border
    @border.bitmap.fill_rect(@border_thickness, @border_thickness,
                  @width, @height, Color.new(0, 0, 0, 0))
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    @contents.update
    # Checks if the player gets any cheese
    array = check_player
    if array.size > 0
      # Removes all the cheese
      for i in array
        # Cheese counters
        $game_variables[@cheese_variable] += 1
        @cheese_amount += 1
        # Deletes the old cheese
        delete_cheese(i)
        # Creates a new one
        @cheese.push(make_cheese)
        
        # Might create another one
        if @cheese.size < Max_Cheese_Amount
          # Creates an extra cheese if enough cheese have been caught
          if @cheese_amount > @cheese.size * @cheese.size + 1
            # Creates a new one
            @cheese.push(make_cheese)
          end
        end
      end
    end
    
    # Draws the cheese
    for i in 0...@cheese.size
      draw_cheese(i, Color.new(10,200,20,255))
    end
    
    # Makes sure the trail isn't too short
    while @player_trail.size < Trail_Length
      # Adds the player positions into the trail
      @player_trail.push([@player_x,@player_y])
    end
    
    coords = @player_trail.shift
    # Draws the trail
    @contents.bitmap.fill_rect(coords[0]-(Size-1),coords[1]-(Size-1),
                          (Size*2)-1, (Size*2)-1, Color.new(0,0,0,255))
    #Calculates the steps per shade
    step = 200 / (Trail_Length)
    for i in 0...Trail_Length-1
      # Calculations
      coords = @player_trail[i]
      s = step*(Trail_Length-i)
      # Draws the trail
      @contents.bitmap.fill_rect(coords[0]-(Size-1),coords[1]-(Size-1),
                          (Size*2)-1, (Size*2)-1, 
                          Color.new(200-s,200-s,100-(s/2),255))
    end
                          
    # Draws the player
    @contents.bitmap.fill_rect(@player_x-(Size-1),@player_y-(Size-1),
                            (Size*2)-1, (Size*2)-1, Color.new(200,200,100,255))
    
    # If UP Is Pressed
    if Input.trigger?(Input::UP)
      @player_dir = 8 unless @player_dir == 2
    end
    # If DOWN Is Pressed
    if Input.trigger?(Input::DOWN)
      @player_dir = 2 unless @player_dir == 8
    end
    # If LEFT Is Pressed
    if Input.trigger?(Input::LEFT)
      @player_dir = 4 unless @player_dir == 6
    end
    # If RIGHT Is Pressed
    if Input.trigger?(Input::RIGHT)
      @player_dir = 6 unless @player_dir == 4
    end
    
    # Moves the player accordingly to the directions
    case @player_dir
    when 8 then @player_y -= @speed # Down
    when 2 then @player_y += @speed # Up
    when 4 then @player_x -= @speed # Left
    when 6 then @player_x += @speed # Right
    end
    # Warping the player
    @player_x = (@player_x) % @width
    @player_y = (@player_y) % @height
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @contents.bitmap.dispose
    @contents.dispose
  end
end
#==============================================================================
# ** Window_SLOLS_Bar
#==============================================================================
class Window_SLOLS_Bar
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @contents = Sprite.new(Viewport.new(0, 416, 640, 64))
    @contents.bitmap = Bitmap.new(640, 64)
    @left_block = Sprite.new(Viewport.new(540-48, 424, 48, 48))
    @left_block.bitmap = Bitmap.new(64, 64)
    @right_block = Sprite.new(Viewport.new(100, 424, 48, 48))
    @right_block.bitmap = Bitmap.new(640, 64)
    @blocks = [@left_block, @right_block]
    @bar = Sprite.new(Viewport.new(270, 446, 100, 4))
    @bar.bitmap = Bitmap.new(200, 4)
    @bar_f = Sprite.new(Viewport.new(270, 446, 100, 4))
    @bar_f.bitmap = Bitmap.new(100, 4)
    @bar_fx = 0
    # The sprites used
    @sprites = [@contents,@bar,@bar_f]
    refresh
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @contents.bitmap.clear
    bar_color = Color.new(225,225,225,255)
    fin_color = Color.new(255,255,0,0)
    @bar.bitmap.fill_rect(0,0,25,4,bar_color)
    @bar.bitmap.fill_rect(50,0,25,4,bar_color)
    @bar.bitmap.fill_rect(100,0,25,4,bar_color)
    @bar.bitmap.fill_rect(150,0,25,4,bar_color)
    @bar_f.bitmap.fill_rect(0,0,100,4,fin_color)
    @blocks.each {|x| x.bitmap.fill_rect(0,0,64,64,fin_color)}
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    @bar.ox -= 1
    @bar.ox = @bar.ox % 100
    @bar.update
    if @bar_fx == 0 && (!$loader.is_a?(Thread) || !$loader.alive?)
      @bar_fx = 1
      @count = 3
      $game_system.se_play($data_system.load_se)
    end
    if @bar_fx > 0 && @bar_fx < 255
      @bar_fx += @count
      @bar_f.bitmap.fill_rect(0,0,100,4,Color.new(255,255,0,@bar_fx))
      @blocks.each do |x| 
        x.bitmap.fill_rect(0,0,48,48,Color.new(255,255,0,@bar_fx))
      end
      case @bar_fx
      when 10..20   then @count = 50
      when 180..230 then @count = 5
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @sprites.each { |x| x.bitmap.dispose}
    @sprites.each { |x| x.dispose}
  end
endAlso..... VX ACE version :
 SLOLS VXAce
  			Code:
#==============================================================================
# ** Snake Look-alike on Loading Script (VXAce Ver)
# -  Original  by Zeriab (v 1.0) - 28-09-2006
# -  VXAce ver by LiTTleDRAgo (v 1.0ace) - 15-05-2017
#------------------------------------------------------------------------------
# 
# EXAMPLE :
#    SceneManager.SLOLS
#    - or -
#    SceneManager.SLOLS(Scene_Map.new) 
# 
#==============================================================================
class Scene_SLOLS
  # The variable the number of dots collected will be stored
  Cheese_Variable = 25
  # The size of the margin in pixels
  Margin = 10
  # The thickness of the border in pixels
  Border_Thickness = 3
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(scene=Scene_Map.new)
    # Sorry, this minigame only for resolution 640 x 480
    @resolution = [Graphics.width,Graphics.height]
    Graphics.resize_screen(640,480) if @resolution != [640,480]
    @next_scene = scene
  end
  
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Creates Bar Window (Loading bar)
    @bar_window = Window_SLOLS_Bar.new
    # Creates Info Window
    info = [Margin, Border_Thickness, Cheese_Variable]
    @info_window = Window_SLOLS_Info.new(*info)
    # Creates Game Window
    @game_window = Window_SLOLS_Game.new(*info)
    # Execute transition
    Graphics.transition
    # Scene Objects
    @scene_objects = [@bar_window, @info_window, @game_window]
    # Main loop
    while SceneManager.scene == self
      # Sleeps a short while to let the other thread work.
      sleep(0.01)
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      ## Frame update
      update
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose Scene Objects
    @scene_objects.each { |x| x.dispose }
  end  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
      # Updates Scene Objects
      @scene_objects.each { |x| x.update }
      # If B or C Button Is Pressed
      if Input.trigger?(Input::B) || Input.trigger?(Input::C)
        # If the loading thread is finished (not alive)
        if !$loader.is_a?(Thread) || !$loader.alive?
          # Play Decision SE
          Sound.play_ok
          # Switch to map screen
          SceneManager.send(:instance_variable_set,:@scene,@next_scene)
          # Camouflage the screen
          @sprite_black = Sprite.new
          @sprite_black.bitmap = (s = Graphics.snap_to_bitmap)
          @sprite_black.bitmap.fill_rect(s.rect,Color.new(0,0,0))
          @scene_objects << @sprite_black.bitmap << @sprite_black
          # Revert resolution
          Graphics.resize_screen(*@resolution) if @resolution != [640,480]
          return
        else
          # Play Buzzer SE
          Sound.play_buzzer
          return
        end
      end
  end
end
#==============================================================================
# ** SceneManager
#------------------------------------------------------------------------------
#  This module manages scene transitions. For example, it can handle
# hierarchical structures such as calling the item screen from the main menu
# or returning from the item screen to the main menu.
#==============================================================================
module SceneManager
  #--------------------------------------------------------------------------
  # * Direct Transition
  #--------------------------------------------------------------------------
  def self.SLOLS(scene_class = nil)
    @stack.push(@scene) if scene_class
    temp = @scene
    @scene = Scene_SLOLS.new(scene_class ? scene_class : temp)
  end
end
#==============================================================================
# ** Window_SLOLS_Info
#==============================================================================
class Window_SLOLS_Info
  # Instructions
  Instructs = [
                'Navigate using the','arrow keys.',
                'Collect green dots.',
                'This is done by','going into them.',
                'A sound will play','when the loading','is finished',
                '','Enter to continue'
             ]
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(margin, border_thickness, cheese_variable)
    # The name of the arrow images
    @arrow_file_names = ["Down_Arrow.png", "Left_Arrow.png",
                         "Right_Arrow.png", "Up_Arrow.png"]
    # The windowskin images
    @windowskin = Cache.tileset("Inside_B") 
    # The arrow images
    @arrow_images = []
    for i in 0..3
      # Makes sure that the program keeps running if one or more of the files
      # given don't exists. (read: wrong filename or missing file)
      begin
        # Reads the bitmap
        bitmap = Bitmap.new('Graphics\\Pictures\\'+@arrow_file_names[i])
      rescue
        # Creates a blank 32x32 bitmap and Blt windowskin arrows if the 
        # reading fails
        bitmap = Bitmap.new(32,32)
        # Arrow down
        bitmap.blt(0,0,@windowskin,Rect.new(128,96,32,-32))if [0,1].include?(i)
        # Arrow up
        bitmap.blt(0,0,@windowskin,Rect.new(128,64,32,32))  if [3,2].include?(i)
        # Arrow left or Arrow right
        if [1,2].include?(i)
          # Clone the Arrow
          copy = bitmap.clone       
          # Rotate 90 degrees clockwise
          32.times do |j|
            32.times {|k| bitmap.set_pixel(32-j-1,k, copy.get_pixel(k, j))}
          end 
          # Dispose clone
          copy.dispose
        end
      rescue Exception => ex
        # Creates a blank 32x32 bitmap if the reading fails
        bitmap = Bitmap.new(32,32)
        # Prints the exception if in Debug mode.
        if $DEBUG
          p ex
        end
      end
      # Pushes the resulting bitmap into the array
      @arrow_images.push(bitmap)
    end
    # Dispose windowskin
    @windowskin.dispose
    # The margin and border thickness
    @margin = margin
    @border_thickness = border_thickness
    @cheese_variable = cheese_variable
    
    # Height with border excluding margin
    @height = 416-@margin
    
    # The instructions Sprite
    @instru = Sprite.new(Viewport.new(480 + @border_thickness,
                        48 + @border_thickness,
                        159 - @margin - @border_thickness*2,
                        282 - @margin*4 + 4))
    @instru.bitmap = Bitmap.new(159 - @margin - @border_thickness*2,
                               282 - @margin*4 + 4)
    @instru.bitmap.font.color = Color.new(225, 225, 225, 255)
    @instru.bitmap.font.size = 20
    
    
    # The main Sprite
    @contents = Sprite.new(Viewport.new(480, 0, 160, @height))
    @contents.bitmap = Bitmap.new(160, @height)
    @contents.bitmap.font.color = Color.new(225, 225, 225, 255)
    @contents.bitmap.font.size = 22
    refresh
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Simplifying the variables used
    border = @border_thickness
    spacing = @margin + border
    
    # Removes any old contents, garbage and so on.
    @contents.bitmap.clear
    # Draws the white block used for the border of the score
    @contents.bitmap.fill_rect(0,@margin,159-@margin,22+border*2,
                                Color.new(225, 225, 225, 255))
    # Draws the white block used for the border of the instructions
    @contents.bitmap.fill_rect(0,48,159-@margin,282+border*2-@margin*4+4,
                                Color.new(225, 225, 225, 255))
    # Draws a black block on the white block creating the border.
    @contents.bitmap.fill_rect(border, 48+border,159-spacing-border,
                               282-@margin*4+4, Color.new(0, 0, 0, 0))
    
    # Draws the left arrow
    @contents.bitmap.blt(0,373-@margin,@arrow_images[1],Rect.new(0,0,43,43))
    # Draws the down arrow
    @contents.bitmap.blt(43+@margin,373-@margin,@arrow_images[0],
                         Rect.new(0,0,43,43))
    # Draws the right arrow
    @contents.bitmap.blt(43*2+@margin*2,373-@margin,@arrow_images[2],
                         Rect.new(0,0,43,43))
    # Draws the up arrow
    @contents.bitmap.blt(43+@margin,330-@margin*2,@arrow_images[3],
                         Rect.new(0,0,43,43))
    
    # Draws the text 'Instructions:'
    @contents.bitmap.draw_text(border, 48, 150-border*2, 22, 'Instructions',1)
    
    # Draws the intructions
    for i in 0...Instructs.size
      # Gets the string
      str = Instructs[i]
      # Draws the string
      @instru.bitmap.draw_text(2, 22*(i+1), 150-border*2, 20, str,1)
    end
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    # Simplifying the variables used
    border = @border_thickness
    spacing = @margin + border
    # Updates the sprite
    @contents.update
    # Removes old contents
    @contents.bitmap.fill_rect(border, spacing, 159-spacing-border, 22,
                               Color.new(0, 0, 0, 0))
    # Draws the amount of dots collected
    @contents.bitmap.draw_text(border, spacing, 153-spacing, 22,
                               $game_variables[@cheese_variable].to_s, 2)
    # Draws the text 'Dots:'
    @contents.bitmap.draw_text(border+2, spacing, 157-spacing, 22, 'Dots:')
  end
  
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @contents.bitmap.dispose
    @contents.dispose
  end
end
#==============================================================================
# ** Window_SLOLS_Game
#==============================================================================
class Window_SLOLS_Game
  #Player Settings
  Size = 5
  Default_Speed = 3
  Trail_Length = 19
  
  #Cheese Settings
  Cheese_Size = 3
  Cheese_Colors = [Color.new(10,200,20,255)]
  Max_Cheese_Amount = 200
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(margin, border_thickness, cheese_variable)
    # The margin and border thickness
    @margin = margin
    @border_thickness = border_thickness
    @cheese_variable = cheese_variable
    
    # Width of the playing field
    @width = 480-(@margin*2) - (@border_thickness*2)
    # Height of the playing field
    @height = 416-(@margin*2) - (@border_thickness*2)
    
    # Player info
    @player_x = 200
    @player_y = 208
    @player_trail = []
    @player_dir = 6   #2 - up, 4 - left, 6 - right, 8 - down
    @speed = Default_Speed
    
    # The cheese array
    @cheese = []
    @cheese.push(make_cheese)
    # The amount of cheese caught during this season.
    @cheese_amount = 0
    
    # Create the Sprite for viewing the border
    view = @margin, @margin, 480-@margin, 416-@margin
    @border = Sprite.new(Viewport.new(*view))
    @border.bitmap = Bitmap.new(480-(@margin*2),416-(@margin*2))
    
    # Creates the main Sprite
    @contents = Sprite.new(Viewport.new(@margin + @border_thickness,
                                @margin + @border_thickness, @width, @height))
    @contents.bitmap = Bitmap.new(@width,@height)
    # Refreshes
    refresh
    # Updates
    update
  end
  
  #--------------------------------------------------------------------------
  # * Make Cheese
  # ---------------------
  # Generates a pointer to a place where a cheese will be at least 3 pixels
  # away from the player
  #--------------------------------------------------------------------------
  def make_cheese
    result = []
    # Total size. (Sum of player size and cheese size)
    size = Size + Cheese_Size
    
    loop do
      # Generating the x and y coordinates
      x = rand(@width - (size + 5)*2)
      y = rand(@height - (size + 5)*2)
      
      # Adjusts the x and y coordinates so the cheese will not be
      # placed in the player
      x += 2*(Size + 5) if x > @width / 2 - (size + 5)
      y += 2*(Size + 5) if y > @height / 2 - (size + 5)
      
      # Makes sure that no cheese exists in that exact same place
      # Does not consider the size of the cheese.
      if !@cheese.include?([x,y])
        result = [x,y]
        break
      end
    end
    
    return result
  end
  
  #--------------------------------------------------------------------------
  # * Check Player
  # --------------------
  # Checks if the player have caught a cheese. (Is touching one)
  # Returns the indices of the cheese in an array
  #--------------------------------------------------------------------------
  def check_player
    result = []
    # Checks every cheese
    for i in 0...@cheese.size
      # Distance in the x-plane
      d = (@cheese[i][0] - @player_x).abs
      # Distance in the y-plane
      d_y = (@cheese[i][1] - @player_y).abs
      # Makes 'd' contain the largest distance
      d = d_y if d < d_y
      
      # If the largest distance is less than the size of the player and the
      # cheese the player must be touching the cheese.
      result.push(i) if d < (Size + Cheese_Size - 1)
    end
    return result
  end
  
  #--------------------------------------------------------------------------
  # * Draw Cheese
  #     i     : The index on the cheese
  #     color : The color wanted for the cheese
  # --------------------
  # Draws the designated cheese with the given color
  #--------------------------------------------------------------------------
  def draw_cheese(i, color)
    cheese = @cheese[i]
    size = Cheese_Size
    # Draws the cheese
    @contents.bitmap.fill_rect(cheese[0]-(size-1),cheese[1]-(size-1),
                            (size*2)-1, (size*2)-1, color)
  end
  
  #--------------------------------------------------------------------------
  # * Delete Cheese
  #     i : The index on the cheese
  # --------------------
  # Deletes the cheese by first drawing it black and then removing the cheese
  # from @cheese.
  #--------------------------------------------------------------------------
  def delete_cheese(i)
    draw_cheese(i, Color.new(0,0,0,0))
    @cheese.delete_at(i)
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @border.bitmap.clear
    # Draws a white block
    @border.bitmap.fill_rect(0,0,480-@margin, 416-@margin,
                  Color.new(225, 225, 225, 255))
    # Draws a smaller black block to give the border
    @border.bitmap.fill_rect(@border_thickness, @border_thickness,
                  @width, @height, Color.new(0, 0, 0, 0))
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    @contents.update
    # Checks if the player gets any cheese
    array = check_player
    if array.size > 0
      # Removes all the cheese
      for i in array
        # Cheese counters
        $game_variables[@cheese_variable] += 1
        @cheese_amount += 1
        # Deletes the old cheese
        delete_cheese(i)
        # Creates a new one
        @cheese.push(make_cheese)
        
        # Might create another one
        if @cheese.size < Max_Cheese_Amount
          # Creates an extra cheese if enough cheese have been caught
          if @cheese_amount > @cheese.size * @cheese.size + 1
            # Creates a new one
            @cheese.push(make_cheese)
          end
        end
      end
    end
    
    # Draws the cheese
    for i in 0...@cheese.size
      draw_cheese(i, Color.new(10,200,20,255))
    end
    
    # Makes sure the trail isn't too short
    while @player_trail.size < Trail_Length
      # Adds the player positions into the trail
      @player_trail.push([@player_x,@player_y])
    end
    
    coords = @player_trail.shift
    # Draws the trail
    @contents.bitmap.fill_rect(coords[0]-(Size-1),coords[1]-(Size-1),
                          (Size*2)-1, (Size*2)-1, Color.new(0,0,0,255))
    #Calculates the steps per shade
    step = 200 / (Trail_Length)
    for i in 0...Trail_Length-1
      # Calculations
      coords = @player_trail[i]
      s = step*(Trail_Length-i)
      # Draws the trail
      @contents.bitmap.fill_rect(coords[0]-(Size-1),coords[1]-(Size-1),
                          (Size*2)-1, (Size*2)-1, 
                          Color.new(200-s,200-s,100-(s/2),255))
    end
                          
    # Draws the player
    @contents.bitmap.fill_rect(@player_x-(Size-1),@player_y-(Size-1),
                            (Size*2)-1, (Size*2)-1, Color.new(200,200,100,255))
    
    # If UP Is Pressed
    if Input.trigger?(Input::UP)
      @player_dir = 8 unless @player_dir == 2
    end
    # If DOWN Is Pressed
    if Input.trigger?(Input::DOWN)
      @player_dir = 2 unless @player_dir == 8
    end
    # If LEFT Is Pressed
    if Input.trigger?(Input::LEFT)
      @player_dir = 4 unless @player_dir == 6
    end
    # If RIGHT Is Pressed
    if Input.trigger?(Input::RIGHT)
      @player_dir = 6 unless @player_dir == 4
    end
    
    # Moves the player accordingly to the directions
    case @player_dir
    when 8 then @player_y -= @speed # Down
    when 2 then @player_y += @speed # Up
    when 4 then @player_x -= @speed # Left
    when 6 then @player_x += @speed # Right
    end
    # Warping the player
    @player_x = (@player_x) % @width
    @player_y = (@player_y) % @height
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @contents.bitmap.dispose
    @contents.dispose
  end
end
#==============================================================================
# ** Window_SLOLS_Bar
#==============================================================================
class Window_SLOLS_Bar
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @contents = Sprite.new(Viewport.new(0, 416, 640, 64))
    @contents.bitmap = Bitmap.new(640, 64)
    @left_block = Sprite.new(Viewport.new(540-48, 424, 48, 48))
    @left_block.bitmap = Bitmap.new(64, 64)
    @right_block = Sprite.new(Viewport.new(100, 424, 48, 48))
    @right_block.bitmap = Bitmap.new(640, 64)
    @blocks = [@left_block, @right_block]
    @bar = Sprite.new(Viewport.new(270, 446, 100, 4))
    @bar.bitmap = Bitmap.new(200, 4)
    @bar_f = Sprite.new(Viewport.new(270, 446, 100, 4))
    @bar_f.bitmap = Bitmap.new(100, 4)
    @bar_fx = 0
    # The sprites used
    @sprites = [@contents,@bar,@bar_f]
    refresh
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @contents.bitmap.clear
    bar_color = Color.new(225,225,225,255)
    fin_color = Color.new(255,255,0,0)
    @bar.bitmap.fill_rect(0,0,25,4,bar_color)
    @bar.bitmap.fill_rect(50,0,25,4,bar_color)
    @bar.bitmap.fill_rect(100,0,25,4,bar_color)
    @bar.bitmap.fill_rect(150,0,25,4,bar_color)
    @bar_f.bitmap.fill_rect(0,0,100,4,fin_color)
    @blocks.each {|x| x.bitmap.fill_rect(0,0,64,64,fin_color)}
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    @bar.ox -= 1
    @bar.ox = @bar.ox % 100
    @bar.update
    if @bar_fx == 0 && (!$loader.is_a?(Thread) || !$loader.alive?)
      @bar_fx = 1
      @count = 3
      Sound.play_load
    end
    if @bar_fx > 0 && @bar_fx < 255
      @bar_fx += @count
      @bar_f.bitmap.fill_rect(0,0,100,4,Color.new(255,255,0,@bar_fx))
      @blocks.each do |x| 
        x.bitmap.fill_rect(0,0,48,48,Color.new(255,255,0,@bar_fx))
      end
      case @bar_fx
      when 10..20   then @count = 50
      when 180..230 then @count = 5
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @sprites.each { |x| x.bitmap.dispose}
    @sprites.each { |x| x.dispose}
  end
end
 
 
 SLOLS:  Snake Look-alike on Load Script
 SLOLS:  Snake Look-alike on Load Script
 

