class Sprite

Attributes

angle[RW]
bush_depth[RW]
bush_opacity[R]
mirror[RW]
src_rect[RW]
wave_amp[RW]
wave_length[RW]
wave_phase[RW]
wave_speed[RW]
x[RW]
y[RW]

Public Class Methods

new(viewport = nil) click to toggle source
Calls superclass method RGSS3::Container::new
# File lib/rgss3/sprite.rb, line 14
def initialize(viewport = nil)
  @x = 0
  @y = 0
  @angle = 0
  @mirror = false
  @bush_depth = 0
  @bush_opacity = 128
  @wave_speed = 360
  @src_rect = Rect.new
  super
end

Public Instance Methods

bitmap=(bitmap) click to toggle source
Calls superclass method
# File lib/rgss3/sprite.rb, line 44
def bitmap=(bitmap)
  super(bitmap)
  @src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
end
bush_opacity=(int) click to toggle source
# File lib/rgss3/sprite.rb, line 40
def bush_opacity=(int)
  @bush_opacity = [[int, 255].min, 0].max
end
draw() click to toggle source
# File lib/rgss3/sprite.rb, line 49
def draw
  if viewport
    x = @x + viewport.rect.x
    y = @y + viewport.rect.y
    w = [width - viewport.ox, viewport.rect.x + viewport.rect.width - x].min
    h = [height - viewport.oy, viewport.rect.y + viewport.rect.height - y].min
    return if w <= 0 || h <= 0
    z = @z + (viewport.z << 12)
    src_x = @src_rect.x + viewport.ox
    src_y = @src_rect.y + viewport.oy
  else
    x = @x
    y = @y
    z = @z
    src_x, src_y, w, h = *@src_rect
  end
  image = bitmap.gosu_image.subimage(src_x, src_y, w, h)
  return unless image
  image.draw_rot(
    x,
    y,
    z,
    @angle,
    ox.fdiv(width),
    oy.fdiv(height),
    @zoom_x * (@mirror ? -1 : 1),
    @zoom_y,
    0xff_ffffff,
    BLEND[@blend_type])
end
flash(color, duration) click to toggle source
# File lib/rgss3/sprite.rb, line 26
def flash(color, duration)
end
height() click to toggle source
# File lib/rgss3/sprite.rb, line 36
def height
  @src_rect.height
end
update() click to toggle source
# File lib/rgss3/sprite.rb, line 29
def update
end
width() click to toggle source
# File lib/rgss3/sprite.rb, line 32
def width
  @src_rect.width
end