Ok im going to create a series of tuts on how to create a Very simple game in Ruby.
Firstly, you'll need the Gosu Lib. found
HERE!after you have that done. Create a folder for the project. then extract the Gosu folder (somewhere thats not in the project folder) then go into the Lib folder of gosu. copy "gosu.for_1_8.so", "gosu.rb" and "fmod.dll" into your project folder.
now. open up Notepad(or a texteditor of your choice) and put this code in:
CODE
require 'gosu'
class GameWindow < Gosu::Window
def initialize
super(640, 480, false)
self.caption = "Gosu Window"
end
def update
end
def draw
end
end
window = GameWindow.new
window.show
now save it as main.rb and run.
now i shall explain what all this does.
CODE
require 'gosu'
this allows the ruby file to use Gosu's built in classes.
CODE
class GameWindow < Gosu::Window
creates a new class defined by the Gosu::Window class, allowing you to create a window.
CODE
def initialize
super(640, 480, false)
self.caption = "Gosu Window"
end
when the GameWindow is created, it sets up a new window of 640 width and 480 hight, with a caption of Gosu Window.
CODE
window = GameWindow.new
window.show
creates a new instance of the GameWindow class, then displays it on the screen.
if there are any problems feel free to ask.
the next part of this tut will show you how to create a sprite on the screen and move it using the arrow keys .. keep a look out
