0
.Rb:2:in `read': No such file or directory @rb_sysopen - Gamesettings.json (Errno::ENOENT)
I’m trying to play a game on ruby
using gosu
, and in order to change the name of the game without having to change all variables related to name in my code and other things, I decided to use .json
. Here is the script code ruby
:
require 'gosu'
require 'json'
data_hash = JSON.parse(File.read('GameSettings.json'))
largura = 360
altura = 360
class GameWindow < Gosu::Window
def initialize(width , height , fullscreen = false)
super
self.caption = data_hash['name']
@message = Gosu::Image.from_text(self, data_hash['Author'], Gosu.default_font_name,30)
end
def draw
@message.draw(10,10,0)
end
end
window = GameWindow.new(largura, altura, false)
window.show
and that of Gamesettings.json:
{
"name" : "Heart Afeathered",
"Author" : "Davi Martins Guedes",
"Nacionality" : "Brazil"
}
and when I run comes this message that I put in the title.
ah, I forgot to tell you, the two work separately, but when I come along comes this error message
– Davi Martins