root/lang/ruby/RogueLike/rogue_like/controller.rb @ 12291

Revision 12291, 0.7 kB (checked in by gan2, 5 years ago)
Line 
1module RogueLike
2  StarRuby::Input.instance_eval do
3    def triggers(device)
4      keys(device, :duration => 1)
5    end
6   
7    def repeatings(device)
8      keys(device, {
9          :duration => 1, :delay => 2, :interval => 0
10        })
11    end
12  end
13 
14  class Controller
15    def update(model)
16      send("update_#{model.state}", model)
17    end
18
19    def update_start(model)
20      model.start_playing
21      # Audio.play_bgm('sounds/bgm/FF5_prelude2', :loop => true)
22    end
23
24    def update_playing(model)
25      if Input.triggers(:keyboard).include?(:r)
26        update_start(model)
27#       elsif Input.repeatings(:mouse).include?(:left)
28#         model.activate_charas
29      end
30      model.activate_charas
31    end
32  end
33end
Note: See TracBrowser for help on using the browser.