Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`load_json': wrong number of arguments (given 3, expected 1..2) (ArgumentError) #6

Open
vasanth9 opened this issue Jan 26, 2022 · 2 comments

Comments

@vasanth9
Copy link

$ruby 02-warmup/random_map.rb

Traceback (most recent call last):
3: from 02-warmup/random_map.rb:47:in <main>' 2: from 02-warmup/random_map.rb:47:in new'
1: from 02-warmup/random_map.rb:16:in initialize' /var/lib/gems/2.7.0/gems/gosu_texture_packer-0.1.8/lib/gosu_texture_packer.rb:7:in load_json': wrong number of arguments (given 3, expected 1..2) (ArgumentError)

@vasanth9
Copy link
Author

@Tileset = Gosu::TexturePacker.load_json(
self, media_path('ground.json'), :precise
)

I removed :precise and ran the code
@Tileset = Gosu::TexturePacker.load_json(
self, media_path('ground.json')
)
and it is giving the err

$ ruby 02-warmup/random_map.rb
Traceback (most recent call last):
7: from 02-warmup/random_map.rb:47:in <main>' 6: from 02-warmup/random_map.rb:47:in new'
5: from 02-warmup/random_map.rb:16:in initialize' 4: from /var/lib/gems/2.7.0/gems/gosu_texture_packer-0.1.8/lib/gosu_texture_packer.rb:8:in load_json'
3: from /var/lib/gems/2.7.0/gems/gosu_texture_packer-0.1.8/lib/gosu_texture_packer/tileset.rb:7:in load_json' 2: from /var/lib/gems/2.7.0/gems/gosu_texture_packer-0.1.8/lib/gosu_texture_packer/tileset.rb:7:in new'
1: from /var/lib/gems/2.7.0/gems/gosu_texture_packer-0.1.8/lib/gosu_texture_packer/tileset.rb:12:in initialize' /var/lib/gems/2.7.0/gems/gosu_texture_packer-0.1.8/lib/gosu_texture_packer/tileset.rb:12:in read': no implicit conversion of GameWindow into String (TypeError)

@spajus
Copy link
Owner

spajus commented Jan 26, 2022

The book was written around 7 years ago, gosu was updated, but book was not. Also https://github.com/spajus/gosu-texture-packer was updated. Unfortunately I no longer support or update the book or the code samples, so the best you can do is figure out what versions of gosu and gosu_texture_packer you are using, get their source code, and figure out how to fix it. Changes should be pretty minimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants