Just starting with dragonruby, I'm trying a file structure like this one:
app/main.rb
app/game.rb
app/components/board.rb
app/components/player.rb
app/components/solid.rb
app/components/sprite.rb
app/components/tile.rb
where my main.rb class is like:
require 'app/game.rb' @game = Game.new def tick(args) @game.args = args @game.tick
end
and game.rb class is:
require 'app/components/sprite.rb' require 'app/components/solid.rb' require 'app/components/player.rb' require 'app/components/tile.rb' class Game attr_gtk attr_accessor :tiles, :player def initialize @tiles = generate_tiles @player = Player.new(0, 0) end # more code...
Then when I start dragonruby ./ , the app fails with:
2020-07-07 22:42:24.264 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
2020-07-07 22:42:24.264 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
2020-07-07 22:42:24.264 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
2020-07-07 22:42:24.264 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
2020-07-07 22:42:24.264 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
2020-07-07 22:42:24.264 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
2020-07-07 22:42:24.311 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
2020-07-07 22:42:24.311 dragonruby[72992:170603] INFO: NameError: uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed.
* EXCEPTION:
uninitialized constant (class Game (included_modules [AttrGTK]) )::Tile
* ERROR: Invocation of Game.new failed. (0)
* INFO: Exported the current game state to file exceptions/game_state_-1.txt.
* INFO: Marked app/components/sprite.rb for reload. (57)
* INFO: Marked app/components/solid.rb for reload. (57)
* INFO: Marked app/components/player.rb for reload. (57)
* INFO: Marked app/components/tile.rb for reload. (57)
However, if I touch the main.rb class with a save, the console display:
* INFO: Marked app/main.rb for reload. (897)
then the game loads correctly.
What I'm missing here?