Not logged inGosu Forums
Forum Gosu Homepage Help Search Register Login
Up Topic Gosu / Gosu Showcase / clone04
- - By MCMayor Date 2012-01-21 19:49 Edited 2012-02-01 19:01
download here

My first Ruby project. It uses both Gosu and RubySDL. If you're on Windows instructions are provided, otherwise you'll have to figure out how to get RubySDL from http://rubyforge.org/frs/?group_id=1006, which shouldn't be too hard.
I'd like to package executables for both Mac and Linux in the future, or at least something to automatically install dependencies. Pointers would be appreciated!

The game supposedly supports controllers. I've got it to work on an xbox 360 controller, please list anything else it does/does not work with.
There is a section of clone04.rb saying:
AButtons = [Gosu::KbSpace, Gosu::GpButton1]
BButtons = [Gosu::KbZ, Gosu::GpButton0]
CButtons = [Gosu::KbLeftShift, Gosu::KbRightShift, Gosu::GpButton4, Gosu::GpButton5, Gosu::GpButton6]
PauseButtons =[Gosu::KbEnter, Gosu::GpButton7]
so it should be easy to edit.
Parent - - By Spooner Date 2012-01-22 01:22 Edited 2012-01-22 01:27
There is a OSX wrapper that jlnr makes which can be used to make OSX executables, but it only includes Gosu/Texplay and Chipmunk binary gems, so it isn't much use if you rely on RubySDL :(

Regarding Ruby gem dependencies, using the Bundler gem is a big boon, and I would highly recommend it to ensure the user can easily run exactly the same gems as you used to develop it.

When using Ocra, you should specify --windows so that it doesn't open a console window when the executable runs.  I'd also recommend you build the exe with Ruby 1.9.3 since it is a lot faster to start up than 1.9.2 and a lot faster to run than 1.8.7 (both matter when making games :D). If you do that, you need to manage paths a bit better, by always using file-relative paths, rather than working-directory-relative paths, since, for example, running "clone4\clone4.exe" won't work.

I'm about to release Relapse v0.2.0, which will make building and releasing executables more idiot-proof and give people more options.

Oh, I had a look at the game too! Feels nice, though I couldn't work out how grabbing and double-jumping worked :$ Good work!
Parent - - By MCMayor Date 2012-01-22 04:06
Gosu::Song has had freezing issues for me and there have been a few other complaints on the board. The game will probably take about 1.5 years to complete so maybe I'll switch to pure Gosu later.
I'll definitely try to use Relapse as soon as the new version releases. As it is it could use a guide.
@paths: newbie question: is this best accomplished by storing the directory somewhere (aka "Dir = File.dirname __FILE__") and appending it to every file name, or is there a way to tell Ruby to always do things relative to the program directory?
Parent - By Spooner Date 2012-01-22 04:32
A good way is to set up some things in your main file:

def image_path(rel_path)
  File.expand_path(File.join("../../media/images", rel_path), __FILE__)
end
def song_path(rel_path)
   File.expand_path(File.join("../../media/music", rel_path), __FILE__)
end

# then you can do
@img = Image.new $window, image_path("frog.png")


As I strongly recommended to move to Ruby 1.9.3 for performance, that uses require_relative so that is fine for requiring. If you need 1.8.7 compatibility, then make sure you do something like:
$LOAD_PATH.unshift File.expand_path("../../", __FILE__)
and then all require paths will be relative to that directory.
Parent - By Spooner Date 2012-01-22 01:25
Oh, out of interest, why did you use SDL's sound rather than Gosu's? As far as I can tell that is all you used and equivalent functionality is fine in Gosu. Didn't look too deep at the code, but that seemed to be the only SDL used...
Parent - By MCMayor Date 2012-02-01 19:07
Version 0.02 is ready here. It features 3 new levels, none of which use the flutter or ring abilities.
Level 1 (bowser's castle) features some lighting effects which may lag older computers. These use Image::draw_as_quad with a different color at each point. Do you think an OpenGL version of the same thing would run faster?
If any of the levels are too hard, I will consider adding the flutter ability. Or maybe just making them easier. Please list any parts that gave you trouble; this isn't supposed to be crazy hard.
Up Topic Gosu / Gosu Showcase / clone04

Powered by mwForum 2.29.1 © 1999-2013 Markus Wichitill