Fala irmão Gustavo! Também sou do Brasil cara! ^^ Mas como só tem gringo aki eu vo ter que explicar em inglês msm... xD
You should use $: variable to add require paths into your game. That way, you should try getting the path to your Game executable (the main folder in this case) and include as much subpaths as you want. This was what i tried:
module GamePath
temp = File.expand_path("Game.exe")
@main = File.dirname(temp) + "/"
@audio = @main + "Audio/"
@data = @main + "Data/"
@graphics = @main + "Graphics/"
class << self
attr_reader :main, :audio ,:data, :graphics
end
end
$: << GamePath.main
$: << GamePath.audio
$: << GamePath.data
$: << GamePath.graphics
$: << GamePath.main + "Scripts/"
$: << GamePath.main + "Scripts/lib"
So, every time the game looks for require files without a complete path, it goes into all those paths you added
Description of the $: array:
Programming Ruby":1c546tk5 said:
via the -I command-line option, followed by an installation-defined standard library location, followed by the current directory (``.''). This variable may be set from within a program to alter the default search path; typically, programs use $: << dir to append dir to the path. {}
Well, the $: thing didn´t worked as i expected, but i could require my .rb files with the GamePath paths., like
require GamePath.main + 'script.rb'
Just take care, you can´t read/save/require txt files inside Graphics and Data folders if your game is (or will be) encrypted.