Re: Error

38 views
Skip to first unread message
Message has been deleted

NeutralAngel

unread,
Mar 11, 2011, 10:03:45 AM3/11/11
to ruby4kids
Can we see your player.rb code? I suspect that you are not correctly
passing the game window to Gosu::Image when creating your player icon
object.

def initialize(game_window)
@game_window = game_window
@icon = Gosu::Image.new(@game_window, "images/player1.png",
true)

On Mar 11, 9:57 am, MaK <mahyar.koshko...@gmail.com> wrote:
> Hi,
>
> I keep getting this error and i'm only on the second screencast:
>
> D:/Files/Projects/Ruby/game 1/player.rb:4:in `initialize': invalid
> null referenc
> e Expected argument 0 of type Gosu::Window &, but got NilClass nil
> (ArgumentErro
> r)
>         in SWIG method 'Gosu::Image'
>         from D:/Files/Projects/Ruby/game 1/player.rb:4:in `new'
>         from D:/Files/Projects/Ruby/game 1/player.rb:4:in `initialize'
>         from my_game.rb:9:in `new'
>         from my_game.rb:9:in `initialize'
>         from my_game.rb:21:in `new'
>         from my_game.rb:21:in `<main>'
>
> I'm on windows XP with ruby 1.9.2. The code is exactly as in the
> video.
>
> MaK

Alberto Morales

unread,
Mar 11, 2011, 10:04:07 AM3/11/11
to ruby...@googlegroups.com
Can you reply the email with the code for player.rb file. Something about player.rb line 4.

Thanks,

Alberto.

MaK

unread,
Mar 12, 2011, 4:57:16 AM3/12/11
to ruby4kids
Hi,
I have found the solution in a previous post.
Thanks for the help.

Mahyar K
Reply all
Reply to author
Forward
0 new messages