Class: RubyFighter::Player::Tileset
- Inherits:
-
Hash
- Object
- Hash
- RubyFighter::Player::Tileset
- Defined in:
- lib/ruby_fighter/player.rb
Instance Method Summary collapse
- #blocking! ⇒ Object
- #draw(*args) ⇒ Object
- #idle! ⇒ Object
-
#initialize(window, name) ⇒ Tileset
constructor
A new instance of Tileset.
- #kick!(&callback) ⇒ Object
- #punch!(&callback) ⇒ Object
- #walking! ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(window, name) ⇒ Tileset
Returns a new instance of Tileset.
82 83 84 85 86 87 88 89 90 |
# File 'lib/ruby_fighter/player.rb', line 82 def initialize(window, name) self[:idle] = RubyFighter::Animation.new(window, "#{name}/idle") self[:walking] = RubyFighter::Animation.new(window, "#{name}/walking") self[:blocking] = RubyFighter::Animation.new(window, "#{name}/blocking") self[:punch] = RubyFighter::Animation.new(window, "#{name}/punch") self[:kick] = RubyFighter::Animation.new(window, "#{name}/kick") idle! end |
Instance Method Details
#blocking! ⇒ Object
100 101 102 |
# File 'lib/ruby_fighter/player.rb', line 100 def blocking! @current_animation = self[:blocking] end |
#draw(*args) ⇒ Object
118 119 120 |
# File 'lib/ruby_fighter/player.rb', line 118 def draw(*args) @current_animation.draw *args end |
#idle! ⇒ Object
92 93 94 |
# File 'lib/ruby_fighter/player.rb', line 92 def idle! @current_animation = self[:idle] end |
#kick!(&callback) ⇒ Object
109 110 111 112 |
# File 'lib/ruby_fighter/player.rb', line 109 def kick!(&callback) @current_animation = self[:kick] @current_animation.play_once &callback end |
#punch!(&callback) ⇒ Object
104 105 106 107 |
# File 'lib/ruby_fighter/player.rb', line 104 def punch!(&callback) @current_animation = self[:punch] @current_animation.play_once &callback end |
#walking! ⇒ Object
96 97 98 |
# File 'lib/ruby_fighter/player.rb', line 96 def walking! @current_animation = self[:walking] end |
#width ⇒ Object
114 115 116 |
# File 'lib/ruby_fighter/player.rb', line 114 def width @current_animation.width end |