Forums Archived

The forums are being archived. See this topic for more information.

Rubygame 2.4 Tutorial

Get help and support with Rubygame

Rubygame 2.4 Tutorial

Postby sparkymat » Mon Mar 09, 2009 12:39 pm

It would be nice if there was a simple tutorial (centered around Rubygame 2.4, with the magic hooks and all). It would certainly be a lot less intimidating than going through the code of the panda demo.
sparkymat
 
Posts: 2
Joined: Mon Mar 09, 2009 12:37 pm

Re: Rubygame 2.4 Tutorial

Postby shawn42 » Sat Mar 14, 2009 5:35 am

That would be nice. I haven't used the magic hooks yet either. I'm looking at possibly using them for gamebox. (see creations thread).

I will hopefully be posting a gamebox tutorial soon.
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: Rubygame 2.4 Tutorial

Postby jacius » Sun Mar 22, 2009 12:14 am

I'm thinking of writing some tutorials soon. Please vote in the poll about what topics you would most like tutorials for. :)
User avatar
jacius
Site Admin
 
Posts: 131
Joined: Fri Feb 06, 2009 11:13 pm

Re: Rubygame 2.4 Tutorial

Postby kiba » Fri May 22, 2009 5:38 am

I beat everyone to the magic hook tutorial by updating part 2of my ownRubygame tutorial. I rock! Muahahahaha.
I write libre games. My libre game programming service is also availiable for anybody that want to pay.

I ran the Libregamewiki, the free gaming encyclopedia.
kiba
 
Posts: 53
Joined: Sat Feb 07, 2009 2:13 am

Re: Rubygame 2.4 Tutorial

Postby antihcl » Sat Jun 27, 2009 1:47 pm

kiba, you *DO* rock, however, I'm having a few problems with your tutorial.

Firstly, the 'setup' variable from lib/setup.rb (setup = Setup.new) isn't available in rbpong.rb due to ruby's variable scope. I just made it a global var ($setup).

The latest problem is with the make_magic_hooks method:
def hook_quit
quit_hooks = {
:escape => :quit,
Rubygame::Events::QuitRequested => :quit,
}
make_magic_hooks(quit_hooks)
end

./lib/setup.rb:23:in `hook_quit': undefined method `make_magic_hooks' for #<Setup:0xb7a3daec> (NoMethodError)

EDIT: Ah, I figured it out.. setup.rb needed "include Rubygame::EventHandler::HasEventHandler" How did I miss that line?! Well done, man. :)
antihcl
 
Posts: 9
Joined: Sat Jun 27, 2009 1:43 pm

Re: Rubygame 2.4 Tutorial

Postby kiba » Sun Jun 28, 2009 2:25 pm

antihcl wrote:kiba, you *DO* rock, however, I'm having a few problems with your tutorial.

Firstly, the 'setup' variable from lib/setup.rb (setup = Setup.new) isn't available in rbpong.rb due to ruby's variable scope. I just made it a global var ($setup).

EDIT: Ah, I figured it out.. setup.rb needed "include Rubygame::EventHandler::HasEventHandler" How did I miss that line?! Well done, man. :)


Can you send me your source code so I can do a comparsion with my code to see why you need a global variable?

All my code on the tutorial are supposed to work. If my tutorial code is the cause rather than users forgetting a step two, I would like to know.
I write libre games. My libre game programming service is also availiable for anybody that want to pay.

I ran the Libregamewiki, the free gaming encyclopedia.
kiba
 
Posts: 53
Joined: Sat Feb 07, 2009 2:13 am

Re: Rubygame 2.4 Tutorial

Postby antihcl » Mon Jun 29, 2009 7:35 am

I looked through it again.. totally my mistake! setup = Setup.new() belongs in rbpong.rb, as your tutorial says, and I'd put it in setup.rb. :\ I'm usually not so inaccurate! I was trying to go too quickly, I guess. :P

Through your tutorial and by looking at the code in the sample demo_rubygame.rb, I'm finally making progress. Thank you for your effort to help us newbies.
antihcl
 
Posts: 9
Joined: Sat Jun 27, 2009 1:43 pm


Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron