Class: Game_Picture
- Inherits:
-
Object
- Object
- Game_Picture
- Defined in:
- lib/rgss3_default_scripts/Game_Picture.rb
Overview
** Game_Picture
This class handles pictures. It is created only when a picture of a specific
number is required internally for the Game_Pictures class.
Instance Attribute Summary collapse
-
#angle ⇒ Object
readonly
rotation angle.
-
#blend_type ⇒ Object
readonly
blend method.
-
#name ⇒ Object
readonly
filename.
-
#number ⇒ Object
readonly
————————————————————————– * Public Instance Variables ————————————————————————–.
-
#opacity ⇒ Object
readonly
opacity level.
-
#origin ⇒ Object
readonly
starting point.
-
#tone ⇒ Object
readonly
color tone.
-
#x ⇒ Object
readonly
x-coordinate.
-
#y ⇒ Object
readonly
y-coordinate.
-
#zoom_x ⇒ Object
readonly
x directional zoom rate.
-
#zoom_y ⇒ Object
readonly
y directional zoom rate.
Instance Method Summary collapse
-
#erase ⇒ Object
————————————————————————– * Erase Picture ————————————————————————–.
-
#init_basic ⇒ Object
————————————————————————– * Initialize Basic Variable ————————————————————————–.
-
#init_rotate ⇒ Object
————————————————————————– * Initialize Rotation ————————————————————————–.
-
#init_target ⇒ Object
————————————————————————– * Initialize Movement Target ————————————————————————–.
-
#init_tone ⇒ Object
————————————————————————– * Initialize Color Tone ————————————————————————–.
-
#initialize(number) ⇒ Game_Picture
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#move(origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration) ⇒ Object
————————————————————————– * Move Picture ————————————————————————–.
-
#rotate(speed) ⇒ Object
————————————————————————– * Change Rotation Speed ————————————————————————–.
-
#show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type) ⇒ Object
————————————————————————– * Show Picture ————————————————————————–.
-
#start_tone_change(tone, duration) ⇒ Object
————————————————————————– * Start Changing Color Tone ————————————————————————–.
-
#update ⇒ Object
————————————————————————– * Frame Update ————————————————————————–.
-
#update_move ⇒ Object
————————————————————————– * Update Picture Move ————————————————————————–.
-
#update_rotate ⇒ Object
————————————————————————– * Update Rotation ————————————————————————–.
-
#update_tone_change ⇒ Object
————————————————————————– * Update Color Tone Change ————————————————————————–.
Constructor Details
#initialize(number) ⇒ Game_Picture
-
Object Initialization
26 27 28 29 30 31 32 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 26 def initialize(number) @number = number init_basic init_target init_tone init_rotate end |
Instance Attribute Details
#angle ⇒ Object (readonly)
rotation angle
22 23 24 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 22 def angle @angle end |
#blend_type ⇒ Object (readonly)
blend method
20 21 22 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 20 def blend_type @blend_type end |
#name ⇒ Object (readonly)
filename
13 14 15 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 13 def name @name end |
#number ⇒ Object (readonly)
-
Public Instance Variables
12 13 14 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 12 def number @number end |
#opacity ⇒ Object (readonly)
opacity level
19 20 21 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 19 def opacity @opacity end |
#origin ⇒ Object (readonly)
starting point
14 15 16 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 14 def origin @origin end |
#tone ⇒ Object (readonly)
color tone
21 22 23 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 21 def tone @tone end |
#x ⇒ Object (readonly)
x-coordinate
15 16 17 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 15 def x @x end |
#y ⇒ Object (readonly)
y-coordinate
16 17 18 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 16 def y @y end |
#zoom_x ⇒ Object (readonly)
x directional zoom rate
17 18 19 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 17 def zoom_x @zoom_x end |
#zoom_y ⇒ Object (readonly)
y directional zoom rate
18 19 20 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 18 def zoom_y @zoom_y end |
Instance Method Details
#erase ⇒ Object
-
Erase Picture
115 116 117 118 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 115 def erase @name = "" @origin = 0 end |
#init_basic ⇒ Object
-
Initialize Basic Variable
36 37 38 39 40 41 42 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 36 def init_basic @name = "" @origin = @x = @y = 0 @zoom_x = @zoom_y = 100.0 @opacity = 255.0 @blend_type = 1 end |
#init_rotate ⇒ Object
-
Initialize Rotation
65 66 67 68 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 65 def init_rotate @angle = 0 @rotate_speed = 0 end |
#init_target ⇒ Object
-
Initialize Movement Target
46 47 48 49 50 51 52 53 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 46 def init_target @target_x = @x @target_y = @y @target_zoom_x = @zoom_x @target_zoom_y = @zoom_y @target_opacity = @opacity @duration = 0 end |
#init_tone ⇒ Object
-
Initialize Color Tone
57 58 59 60 61 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 57 def init_tone @tone = Tone.new @tone_target = Tone.new @tone_duration = 0 end |
#move(origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration) ⇒ Object
-
Move Picture
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 88 def move(origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration) @origin = origin @target_x = x.to_f @target_y = y.to_f @target_zoom_x = zoom_x.to_f @target_zoom_y = zoom_y.to_f @target_opacity = opacity.to_f @blend_type = blend_type @duration = duration end |
#rotate(speed) ⇒ Object
-
Change Rotation Speed
101 102 103 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 101 def rotate(speed) @rotate_speed = speed end |
#show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type) ⇒ Object
-
Show Picture
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 72 def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type) @name = name @origin = origin @x = x.to_f @y = y.to_f @zoom_x = zoom_x.to_f @zoom_y = zoom_y.to_f @opacity = opacity.to_f @blend_type = blend_type init_target init_tone init_rotate end |
#start_tone_change(tone, duration) ⇒ Object
-
Start Changing Color Tone
107 108 109 110 111 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 107 def start_tone_change(tone, duration) @tone_target = tone.clone @tone_duration = duration @tone = @tone_target.clone if @tone_duration == 0 end |
#update ⇒ Object
-
Frame Update
122 123 124 125 126 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 122 def update update_move update_tone_change update_rotate end |
#update_move ⇒ Object
-
Update Picture Move
130 131 132 133 134 135 136 137 138 139 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 130 def update_move return if @duration == 0 d = @duration @x = (@x * (d - 1) + @target_x) / d @y = (@y * (d - 1) + @target_y) / d @zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d @zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d @opacity = (@opacity * (d - 1) + @target_opacity) / d @duration -= 1 end |
#update_rotate ⇒ Object
-
Update Rotation
155 156 157 158 159 160 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 155 def update_rotate return if @rotate_speed == 0 @angle += @rotate_speed / 2.0 @angle += 360 while @angle < 0 @angle %= 360 end |
#update_tone_change ⇒ Object
-
Update Color Tone Change
143 144 145 146 147 148 149 150 151 |
# File 'lib/rgss3_default_scripts/Game_Picture.rb', line 143 def update_tone_change return if @tone_duration == 0 d = @tone_duration @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d @tone_duration -= 1 end |