lib/missile-command-ruby.rb in missile-command-ruby-0.0.5 vs lib/missile-command-ruby.rb in missile-command-ruby-0.0.6
- old
+ new
@@ -10,17 +10,18 @@
require 'explosion'
require 'missile'
require 'cross_hair'
class MissileCommand < Game
+ use CollisionSystem
+ #use StalkerSystem, :stalk => [Actor, Silo, Missile, Explosion, TextBox]
def initialize
super
- setup_events
@info = TextBox.new(:size => 15)
@info.text("Press F1 to hide this text | F2 debug info | F3 toggle pause", :size => 24)
- @info.watch(@systems[FpsSystem], :size => 20)
+ @info.watch(lambda{ fps }, :size => 20)
@info.watch(@systems[StalkerSystem], :color => 0xff33ccff)
@info.text("Click on screen to launch some missiles!")
end
def load_resources
@@ -34,17 +35,9 @@
def setup_input
set_keys(Gosu::KbEscape => :close,
Gosu::KbF1 => [:toggle_info, false],
Gosu::KbF2 => [:debug!, false],
Gosu::KbF3 => [:pause!, false])
- end
-
- def setup_systems
- # It's important to call super here to setup the InputSystem
- super
- use(CollisionSystem)
- use(FpsSystem)
- use(StalkerSystem, :stalk => [Actor, Silo, Missile, Explosion, TextBox, Object])
end
def setup_actors
@player = Silo.new(:x => width/2,
:width => 100,