Class: Sprite
Constant Summary
Constants included from RGSS3::Container
Instance Attribute Summary collapse
-
#angle ⇒ Object
Returns the value of attribute angle.
-
#bush_depth ⇒ Object
Returns the value of attribute bush_depth.
-
#bush_opacity ⇒ Object
Returns the value of attribute bush_opacity.
-
#mirror ⇒ Object
Returns the value of attribute mirror.
-
#src_rect ⇒ Object
Returns the value of attribute src_rect.
-
#wave_amp ⇒ Object
Returns the value of attribute wave_amp.
-
#wave_length ⇒ Object
Returns the value of attribute wave_length.
-
#wave_phase ⇒ Object
Returns the value of attribute wave_phase.
-
#wave_speed ⇒ Object
Returns the value of attribute wave_speed.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Attributes included from RGSS3::Container
#bitmap, #blend_type, #color, #opacity, #ox, #oy, #tone, #viewport, #visible, #z, #zoom_x, #zoom_y
Instance Method Summary collapse
- #bitmap=(bitmap) ⇒ Object
- #draw ⇒ Object
- #flash(color, duration) ⇒ Object
- #height ⇒ Object
-
#initialize(viewport = nil) ⇒ Sprite
constructor
A new instance of Sprite.
- #update ⇒ Object
- #width ⇒ Object
Methods included from RGSS3::Container
#dispose, #disposed?, #do_draw, #initialize_copy
Constructor Details
Instance Attribute Details
#angle ⇒ Object
Returns the value of attribute angle.
11 12 13 |
# File 'lib/rgss3/sprite.rb', line 11 def angle @angle end |
#bush_depth ⇒ Object
Returns the value of attribute bush_depth.
12 13 14 |
# File 'lib/rgss3/sprite.rb', line 12 def bush_depth @bush_depth end |
#bush_opacity ⇒ Object
Returns the value of attribute bush_opacity.
7 8 9 |
# File 'lib/rgss3/sprite.rb', line 7 def bush_opacity @bush_opacity end |
#mirror ⇒ Object
Returns the value of attribute mirror.
11 12 13 |
# File 'lib/rgss3/sprite.rb', line 11 def mirror @mirror end |
#src_rect ⇒ Object
Returns the value of attribute src_rect.
9 10 11 |
# File 'lib/rgss3/sprite.rb', line 9 def src_rect @src_rect end |
#wave_amp ⇒ Object
Returns the value of attribute wave_amp.
10 11 12 |
# File 'lib/rgss3/sprite.rb', line 10 def wave_amp @wave_amp end |
#wave_length ⇒ Object
Returns the value of attribute wave_length.
10 11 12 |
# File 'lib/rgss3/sprite.rb', line 10 def wave_length @wave_length end |
#wave_phase ⇒ Object
Returns the value of attribute wave_phase.
10 11 12 |
# File 'lib/rgss3/sprite.rb', line 10 def wave_phase @wave_phase end |
#wave_speed ⇒ Object
Returns the value of attribute wave_speed.
10 11 12 |
# File 'lib/rgss3/sprite.rb', line 10 def wave_speed @wave_speed end |
#x ⇒ Object
Returns the value of attribute x.
8 9 10 |
# File 'lib/rgss3/sprite.rb', line 8 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
8 9 10 |
# File 'lib/rgss3/sprite.rb', line 8 def y @y end |
Instance Method Details
#bitmap=(bitmap) ⇒ Object
44 45 46 47 |
# File 'lib/rgss3/sprite.rb', line 44 def bitmap=(bitmap) super(bitmap) @src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) end |
#draw ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/rgss3/sprite.rb', line 49 def draw if x = @x + .rect.x y = @y + .rect.y w = [width - .ox, .rect.x + .rect.width - x].min h = [height - .oy, .rect.y + .rect.height - y].min return if w <= 0 || h <= 0 z = @z + (.z << 12) src_x = @src_rect.x + .ox src_y = @src_rect.y + .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) ⇒ Object
26 27 |
# File 'lib/rgss3/sprite.rb', line 26 def flash(color, duration) end |
#height ⇒ Object
36 37 38 |
# File 'lib/rgss3/sprite.rb', line 36 def height @src_rect.height end |
#update ⇒ Object
29 30 |
# File 'lib/rgss3/sprite.rb', line 29 def update end |
#width ⇒ Object
32 33 34 |
# File 'lib/rgss3/sprite.rb', line 32 def width @src_rect.width end |