class Core::Game::Combat::BattleEnemy

Attributes

data[R]
gui[W]

Public Class Methods

new(enemy, x, y, z) click to toggle source
Calls superclass method Core::Game::Combat::BattleObject::new
# 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

Public Instance Methods

draw() click to toggle source
Calls superclass method Core::Game::Combat::BattleObject#draw
# File lib/game/combat/battle.rb, line 174
def draw
  super
end
name() click to toggle source
# File lib/game/combat/battle.rb, line 178
def name
  return @data.name
end
update(pause) click to toggle source
Calls superclass method Core::Game::Combat::BattleObject#update
# 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