28 May '12, 4am

調べてみるといろいろ出てくるねぇ Web:"Rubyist Magazine - Ruby/SDL で始めるゲームプログラミング【後編】"

# キー定義 (Enter キーを追加) class Input define_key SDL::Key::ESCAPE, :exit define_key SDL::Key::RETURN, :ok # Enter キー (タイトル画面で使う) define_key SDL::Key::LEFT, :left define_key SDL::Key::RIGHT, :right end # タイトル画面 class TitleScene def initialize @title_image = SDL::Surface.load("image/title.png") end def start end # Enter が押されたらゲーム画面へ def act(input) if input.ok return :game else return nil end end # タイトル画像を表示するだけ def render(screen) screen.put(@title_image, 0, 0) end end # ゲーム画面 class GameScene def initialize @player = Player.new(240) @items = Items.new end def start @items.clear end # 爆弾に当たったらゲームオーバー画面へ def act(input) @player.act(input) is_crashed = @items.act(@player) if is_crashed return :game_over else return nil end end def render(screen) screen.fill_rect(0, 0, SCREEN_W, HOLIZON, [128, 255, 255]) screen.fill_rect(0, HOLIZON, SCREEN_W, SCREEN_H-HOLIZON, [0, 128, 0]) @player.rend...

Full article: http://jp.rubyist.net/magazine/?0019-GameProgramingForRub...

Tweets

Including Other Files in Ruby: Ruby Study Notes...

rubylearning.com 03 Jun '12, 6am

When writing your first few Ruby programs, you tend to place all of your code in a single file. But as you grow as a Ruby ...

Is there really no comprehensive, nicely styled...

apidock.com 29 May '12, 9am

This command will create following directories and install files onto them. * ${DESTDIR}${prefix}/bin * ${DESTDIR}${prefix...