class Core::Game::Combat::BattleObject
Superclass for enemies and actors
Attributes
target[R]
Public Class Methods
new(graphic, x, y, z=Core::MAPOBJECT_Z, color=Gosu::Color::WHITE)
click to toggle source
# File lib/game/combat/battle.rb, line 112 def initialize(graphic, x, y, z=Core::MAPOBJECT_Z, color=Gosu::Color::WHITE) @frame = 0 @x, @y, @z = x, y, z @color = color if File.exists?("graphics/combat/#{graphic}.png") @graphics = Gosu::Image.load_tiles(Core.window, "graphics/combat/#{graphic}.png", -4, -4, false) @frame = 4 else @graphics = [Core.sprite("missing")] end @target = nil end
Public Instance Methods
attacked(hit)
click to toggle source
# File lib/game/combat/battle.rb, line 136 def attacked(hit) @target = nil end
draw()
click to toggle source
# File lib/game/combat/battle.rb, line 128 def draw if @graphics[@frame] @graphics[@frame].draw(@x, @y, @z, 1, 1, @color) else @graphics.first.draw(@x, @y, @z, 1, 1, @color) end end
name()
click to toggle source
# File lib/game/combat/battle.rb, line 140 def name return "" end
update(pause)
click to toggle source
# File lib/game/combat/battle.rb, line 125 def update(pause) end