class Core::Game::Combat::Actor

Party member

Attributes

character[R]
ready_shown[RW]

Public Class Methods

new(char, x, y, z) click to toggle source
Calls superclass method Core::Game::Combat::BattleObject::new
# File lib/game/combat/battle.rb, line 187
def initialize(char, x, y, z)
  super(char.charset, x, y, z)
  @character = char
  @health = Bar.new(x - 8, y - 8, 100, 48, 6, :health, 100, false)
  @health.set(@character.health)
  @next = Bar.new(x - 8, y - 16, 100, 48, 6, :health, 600 - (@character.agility*5), false)
  @next.visible = false
  @ready = false
  @ready_shown = false
  @moving = false
  @ready_time = 600 - (@character.agility*5)
end

Public Instance Methods

draw() click to toggle source
Calls superclass method Core::Game::Combat::BattleObject#draw
# File lib/game/combat/battle.rb, line 218
def draw
  super
  @health.draw
  @next.draw
end
name() click to toggle source
# File lib/game/combat/battle.rb, line 231
def name
  return @character.name
end
ready!() click to toggle source
# File lib/game/combat/battle.rb, line 226
def ready!
  @next.fade
  @ready = true
end
ready?() click to toggle source
# File lib/game/combat/battle.rb, line 223
def ready?
  return @ready
end
update(pause) click to toggle source
Calls superclass method Core::Game::Combat::BattleObject#update
# File lib/game/combat/battle.rb, line 199
def update(pause)
  super
  if !pause
    if @moving
      @health.x, @health.y = @x - 8, @y - 8
      @next.x, @health.y = @x - 8, @y - 16
    end
    if @ready_time == 0
      ready!
      @ready_time = -1
    elsif @ready_time > 0
      @ready_time -= 1
      @next.visible = true
      @next.set(@next.max - @ready_time)
    end
  end
  @health.update
  @next.update
end