Hey there.
So to cut a long story short - for a few hours now I have been completely puzzled as to why my game isnt reading the data back in correctly at load.
Here is the code that is 'saving / loading' my data...
def self.save_game_without_rescue File.open(filename, "wb") do |file| Marshal.dump({ :space_shooter => $space_shooter }, file) end return true end def self.load_game_without_rescue p "Loading Data" File.open(filename, "rb") do |file| Marshal.load(file) extract_save_contents(Marshal.load(file)) end p "Loaded Data #{$space_shooter}" return true end def self.extract_save_contents(data) $space_shooter = data[:space_shooter] endNow for whatever reason - it is making the save file no problem. But when I try to load the data back in is not allowing it.
If I remove the rescue clause for the loading process I get an end of file error :/
Not really sure whats causing this..
anyone have any insight on that?
Or alternatively - anyone have a way for me to save a global variable to be re-utilized when the game is next loaded?
So to cut a long story short - for a few hours now I have been completely puzzled as to why my game isnt reading the data back in correctly at load.
Here is the code that is 'saving / loading' my data...
def self.save_game_without_rescue File.open(filename, "wb") do |file| Marshal.dump({ :space_shooter => $space_shooter }, file) end return true end def self.load_game_without_rescue p "Loading Data" File.open(filename, "rb") do |file| Marshal.load(file) extract_save_contents(Marshal.load(file)) end p "Loaded Data #{$space_shooter}" return true end def self.extract_save_contents(data) $space_shooter = data[:space_shooter] endNow for whatever reason - it is making the save file no problem. But when I try to load the data back in is not allowing it.
If I remove the rescue clause for the loading process I get an end of file error :/
Not really sure whats causing this..
anyone have any insight on that?
Or alternatively - anyone have a way for me to save a global variable to be re-utilized when the game is next loaded?
