Class: Core::Game::Combat::BattleEnemy
- Inherits:
-
BattleObject
- Object
- BattleObject
- Core::Game::Combat::BattleEnemy
- Defined in:
- lib/game/combat/battle.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#gui ⇒ Object
writeonly
Sets the attribute gui.
Attributes inherited from BattleObject
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(enemy, x, y, z) ⇒ BattleEnemy
constructor
A new instance of BattleEnemy.
- #name ⇒ Object
- #update(pause) ⇒ Object
Methods inherited from BattleObject
Constructor Details
#initialize(enemy, x, y, z) ⇒ BattleEnemy
Returns a new instance of BattleEnemy.
148 149 150 151 152 153 154 |
# File 'lib/game/combat/battle.rb', line 148 def initialize(enemy, x, y, z) super(enemy.graphic, x, y, z) @data = enemy @gui = nil @frame = 8 @w, @h = @graphics.first.width, @graphics.first.height end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
146 147 148 |
# File 'lib/game/combat/battle.rb', line 146 def data @data end |
#gui=(value) ⇒ Object (writeonly)
Sets the attribute gui
147 148 149 |
# File 'lib/game/combat/battle.rb', line 147 def gui=(value) @gui = value end |
Instance Method Details
#draw ⇒ Object
174 175 176 |
# File 'lib/game/combat/battle.rb', line 174 def draw super end |
#name ⇒ Object
178 179 180 |
# File 'lib/game/combat/battle.rb', line 178 def name return @data.name end |
#update(pause) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/game/combat/battle.rb', line 156 def update(pause) super x, y = Core.window.mouse_x, Core.window.mouse_y if Core.inside?(x, y, @x, @y, @x+@w, @y+@h) and Core.window.pressed?(Gosu::MsLeft) if x - 160 < 0 x = 160 elsif x > 1024-320 x = 1024-320 end if y - 128 < 0 y = 128 elsif y > 512 y = 512 end @gui.open_info(self, 256, 160) end end |