1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
| WIDTH = 640
HEIGHT = 480
DELTA_WIDTH = (WIDTH - 544).abs
DELTA_HEIGHT = (HEIGHT - 416).abs
class Game_Map
def calc_parallax_x(bitmap)
if bitmap == nil
return 0
elsif @parallax_loop_x
return @parallax_x / 16
elsif loop_horizontal?
return 0
else
w1 = bitmap.width - WIDTH
w2 = @map.width * 32 - WIDTH
if w1 <= 0 or w2 <= 0
return 0
else
return @parallax_x * w1 / w2 / 8
end
end
end
end
class Spriteset_Map
def create_viewports
@viewport1 = Viewport.new(0, 0, WIDTH, HEIGHT)
@viewport2 = Viewport.new(0, 0, WIDTH, HEIGHT)
@viewport3 = Viewport.new(0, 0, WIDTH, HEIGHT)
@viewport2.z = 50
@viewport3.z = 100
end
end
class Spriteset_Battle
def create_viewports
@viewport1 = Viewport.new(0, 0, WIDTH, HEIGHT)
@viewport2 = Viewport.new(0, 0, WIDTH, HEIGHT)
@viewport3 = Viewport.new(0, 0, WIDTH, HEIGHT)
@viewport2.z = 50
@viewport3.z = 100
end
end
class Game_Player < Game_Character
CENTER_X = (WIDTH / 2 - 16) * 8 # 画面中央の X 座標 * 8
CENTER_Y = (HEIGHT / 2 - 16) * 8
end
class Sprite_Timer < Sprite
def initialize(viewport)
super(viewport)
self.bitmap = Bitmap.new(88, 48)
self.bitmap.font.name = "Arial"
self.bitmap.font.size = 32
self.x = WIDTH - self.bitmap.width
self.y = 0
self.z = 200
update
end
end
class Sprite_Base < Sprite
def start_animation(animation, mirror = false)
dispose_animation
@animation = animation
return if @animation == nil
@animation_mirror = mirror
@animation_duration = @animation.frame_max * 4 + 1
load_animation_bitmap
@animation_sprites = []
if @animation.position != 3 or not @@animations.include?(animation)
if @use_sprite
for i in 0..15
sprite = ::Sprite.new(viewport)
sprite.visible = false
@animation_sprites.push(sprite)
end
unless @@animations.include?(animation)
@@animations.push(animation)
end
end
end
if @animation.position == 3
if viewport == nil
@animation_ox = WIDTH / 2
@animation_oy = HEIGHT / 2
else
@animation_ox = viewport.rect.width / 2
@animation_oy = viewport.rect.height / 2
end
else
@animation_ox = x - ox + width / 2
@animation_oy = y - oy + height / 2
if @animation.position == 0
@animation_oy -= height / 2
elsif @animation.position == 2
@animation_oy += height / 2
end
end
end
end
class Window_Base < Window
def x=(x)
super(x + DELTA_WIDTH / 2)
end
def y=(y)
super(y + DELTA_HEIGHT/ 2)
end
end
class Scene_Battle < Scene_Base
def create_info_viewport
@info_viewport = Viewport.new(0, 288, WIDTH, HEIGHT)
@info_viewport.z = 100
@status_window = Window_BattleStatus.new
@party_command_window = Window_PartyCommand.new
@actor_command_window = Window_ActorCommand.new
@status_window.viewport = @info_viewport
@party_command_window.viewport = @info_viewport
@actor_command_window.viewport = @info_viewport
@status_window.x = 128
@actor_command_window.x = 544
@info_viewport.visible = false
end
end
class Scene_Item < Scene_Base
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, WIDTH, HEIGHT)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@item_window = Window_Item.new(0, 56, 544, 360)
@item_window.help_window = @help_window
@item_window.active = false
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
end
def show_target_window(right)
@item_window.active = false
width_remain = WIDTH - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, HEIGHT)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, HEIGHT)
@viewport.ox = @target_window.width
end
end
def hide_target_window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
@viewport.rect.set(0, 0, WIDTH, HEIGHT)
@viewport.ox = 0
end
end
class Scene_Skill < Scene_Base
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 0, WIDTH, HEIGHT)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@status_window = Window_SkillStatus.new(0, 56, @actor)
@status_window.viewport = @viewport
@skill_window = Window_Skill.new(0, 112, 544, 304, @actor)
@skill_window.viewport = @viewport
@skill_window.help_window = @help_window
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
end
def show_target_window(right)
@skill_window.active = false
width_remain = WIDTH - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, HEIGHT)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, HEIGHT)
@viewport.ox = @target_window.width
end
end
def hide_target_window
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
@viewport.rect.set(0, 0, WIDTH, HEIGHT)
@viewport.ox = 0
end
end |