miyako/sample/space/space_fight.rb
# Sample Game "Simple Shooting!"
# 2006.10.21 Cyross Makoto
$LOAD_PATH.push('../../')
require 'miyako'
require 'singleton'
require 'component'
module Miyako
Screen.fps = 40
setTitle("Simple Shooting! by Miyako")
class SimpleShooting
include Story
class Scene_Init < Scene
def init
@comp = MainComponent.instance
end
def setup
@comp.setup
end
def update
return "Main"
end
end
class Scene_Main < Scene
def init
@comp = MainComponent.instance
end
def update
return @comp.update(@now, @prev, @upper)
end
end
class Scene_Clear < Scene
def init
@comp = MainComponent.instance
@mes1 = Shape.create(:text, ["Go to next stage.{cr}{color yellow}Go to next stage.", Font.sans_serif, 24, Color::WHITE, :center, :middle])
@mes1.oh = @mes1.oh >> 1
@mes1.set_layout(:center, :middle)
@mes2 = Shape.create(:text, ["Push 1st or z key.", Font.sans_serif, 16, Color::WHITE, :center, :middle])
@mes2.snap(@mes1)
@mes2.set_layout(:center, [:bottom, :outside])
@oy_list = [0, @mes1.oh]
@oy_ptr = 0
@wait = WaitCounter.new(0.2)
end
def setup
@mes1.show
@mes2.show
@wait.start
end
def update
return "End" if Input.pushed_any?(:esc) || Input.quit?
return "Main" if Input.pushed_any?(:btn1)
if @wait.finish?
@oy_ptr = (@oy_ptr + 1) % @oy_list.length
@mes1.oy = @oy_list[@oy_ptr]
@wait.start
end
@comp.scroll
return @now
end
def final
@mes2.hide
@mes1.hide
@comp.next_stage if @now == "Main"
end
end
class Scene_End < Scene
def init
@comp = MainComponent.instance
end
def update
return nil
end
def final
@comp.final
end
end
end
sf = SimpleShooting.new
sf.run("Init")
end