draw a window - error

10 views
Skip to first unread message

sergi

unread,
Apr 28, 2011, 1:27:27 AM4/28/11
to ruby4kids
Hi, Group,

I'm getting the following error when trying to draw the very first
window (from 2nd video):

my_game.rb:4: udefined method 'Gosu' for main:Object (NoMethodError)

earlier, I received confirmation that Gosu is installed:
"Successfully installed gosu-0.7.29-universal-darwin"

However, now I receive this error message after typing these 2
commands:
$ ls my_game.rb
$ ruby my_game.rb


I have identical code in the my_game.rb file to what our instructor is
showing in the video. Here it is:

<!-- begin code -->

require 'rubygems'
require 'gosu'

class MyGame < Gosu:Window
def initialize
super(300, 400, false)
end

def update
end

def draw
end

end

window = MyGame.new
window.show

<!-- end code -->
can anybody help? Thanks much! Sergi

anthony santelices

unread,
Apr 28, 2011, 12:32:15 PM4/28/11
to ruby...@googlegroups.com
i am not completly sure about this 1 but i think u need to put an extra ":" at line 4 where it says:


class MyGame < Gosu:Window

and change it to:

class MyGame < Gosu::Window

sergi

unread,
Apr 29, 2011, 5:43:12 PM4/29/11
to ruby4kids
thanks anthony. not sure how to re-attack the problem. will get back
to this in the near future.

On Apr 28, 9:32 am, anthony santelices <anthony.santeli...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages