Class: Sprite
- Inherits:
-
Object
- Object
- Sprite
- Includes:
- RGSS3::SpriteContainer
- Defined in:
- lib/rgss3/sprite.rb
Constant Summary
Constants included from RGSS3::SpriteContainer
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::SpriteContainer
#bitmap, #blend_type, #color, #zoom_x, #zoom_y
Attributes included from RGSS3::Container
#opacity, #ox, #oy, #tone, #viewport, #visible, #z
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?, #initialize_copy
Constructor Details
#initialize(viewport = nil) ⇒ Sprite
Returns a new instance of Sprite.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rgss3/sprite.rb', line 14 def initialize( = nil) @x = 0 @y = 0 @angle = 0 @mirror = false @bush_depth = 0 @bush_opacity = 128 @wave_speed = 360 @src_rect = Rect.new(0, 0, 0, 0) super() end |
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
48 49 50 51 |
# File 'lib/rgss3/sprite.rb', line 48 def bitmap=(bitmap) super(bitmap) @src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) end |
#draw ⇒ Object
53 54 55 56 |
# File 'lib/rgss3/sprite.rb', line 53 def draw return if !@visible || @opacity == 0 || @bitmap == nil @bitmap.gosu_image.draw_rot(@x, @y, @z, @angle, ox.fdiv(width), oy.fdiv(height), @zoom_x * (@mirror ? -1 : 1), @zoom_y, 0xffffffff, BLEND[@blend_type]) end |
#flash(color, duration) ⇒ Object
26 27 28 29 |
# File 'lib/rgss3/sprite.rb', line 26 def flash(color, duration) @flash_color = color || Color.new(0, 0, 0, 0) @duration = duration end |
#height ⇒ Object
40 41 42 |
# File 'lib/rgss3/sprite.rb', line 40 def height @src_rect.height end |
#update ⇒ Object
31 32 33 34 |
# File 'lib/rgss3/sprite.rb', line 31 def update @duration = [@duration - 1, 0].max @flash_color = nil if @duration == 0 end |
#width ⇒ Object
36 37 38 |
# File 'lib/rgss3/sprite.rb', line 36 def width @src_rect.width end |