| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 2 |
| 经验 | |
| 最后登录 | 2025-11-2 |
| 在线时间 | 835 小时 |
- 梦石
- 0
- 星屑
- 201
- 在线时间
- 835 小时
- 注册时间
- 2012-9-16
- 回帖
- 1598
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 yangjunyin2002 于 2013-6-2 14:00 编辑
下面是个转盘脚本,就像苏联君的古遗迹探秘那游戏的战斗一样,战斗选项是转盘式的。不过这是用于640,480分辨率的脚本。我改来改去,还是没用。我的游戏分辨率是默认的544,416啊...
- module Zii
- FIGHT = 132
- ESCAPE = 9
- ATTACK = 1
- GUARD = 6
- SKILL = 8
- ITEM = 7
- TURN = "Turn"
- STATUS_FACE = "Face"
- STATUS_LINE = "Line"
- LINE_SIZE = 14
- def self.turn_normal?
- return false if TURN == "Turn on"
- return true if TURN == "Turn Off"
- return true
- end
- def self.battle_face?
- return true if STATUS_FACE == "Face"
- return false
- end
- def self.line_name?
- return true if STATUS_LINE == "Line"
- return false
- end
- end
- class Window_Base
- def draw_face(face_name, face_index, x, y, size = 96, opacity = 255)
- bitmap = Cache.face(face_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + (96 - size) / 2
- rect.y = face_index / 4 * 96 + (96 - size) / 2
- rect.width = size
- rect.height = size
- self.contents.blt(x, y, bitmap, rect, opacity)
- bitmap.dispose
- end
- def draw_actor_face(actor, x, y, size = 96, opacity = 255)
- draw_face(actor.face_name, actor.face_index, x, y, size, opacity)
- end
- end
- class Window_SpinCommand < Window_Base
- attr_reader :index
- attr_reader :help_window
- def initialize(cx, cy, commands, setting = {})
- @radius = setting.has_key?("R") ? setting["R"] : 40
- @speed = setting.has_key?("S") ? setting["S"] : 36
- @spin_back = setting.has_key?("G") ? setting["G"] : ""
- @spin_line = setting.has_key?("L") ? setting["L"] : nil
- x, y = cx - @radius - 28, cy - @radius - 28
- height =210
- width = 210
- super(x, y, width, height)
- self.opacity = 0
- @index = 0
- @commands = commands
- @spin_right = true
- @spin_count = 0
- update_cursor
- end
- def draw_spin_graphic(i, cx, cy)
- case command_kind(i)
- when "icon"
- draw_icon(command_pull(i), cx - 12, cy - 12, command_enabled?(i))
- end
- end
- def refresh
- set_spin
- end
- def draw_item(index, enabled = true)
- @commands[index][3] = enabled
- set_spin
- end
- def command_name(index = @index)
- return "" if index < 0
- name = @commands[index][0]
- return name != nil ? name : ""
- end
- def command_kind(index)
- result = @commands[index][1]
- return result != nil ? result : ""
- end
- def command_pull(index)
- result = @commands[index][2]
- return result != nil ? result : ""
- end
- def command_enabled?(index)
- result = @commands[index][3]
- return result != nil ? result : true
- end
- def set_index(name)
- n = -1
- for i in [email]0...@commands.size[/email]
- n = i if @commands[i][0] == name
- end
- @index = n if n >= 0
- update_cursor
- call_update_help
- set_spin
- end
- def index=(index)
- @index = index
- update_cursor
- call_update_help
- set_spin
- end
- def center_x
- return contents.width / 2
- end
- def center_y
- return contents.height / 2
- end
- def item_max
- return @commands.size
- end
- def set_background
- return if @spin_back == ""
- bitmap = Cache.system(@spin_back)
- rect = Rect.new(-20, 3,544, 416)# 1210, 1250)
- self.contents.blt(12, 12, bitmap, rect)
- end
- def set_text
- return if @spin_line == nil
- y = center_y - WLH / 2 + @spin_line
- self.contents.draw_text(center_x - 48, y, 96, WLH, command_name, 1)
- end
- def angle_size
- return (Math::PI * 2 / item_max)
- end
- def set_spin_count
- @spin_count = angle_size * 360 / @speed
- set_spin(true)
- end
- def set_spin(spin = false)
- self.contents.clear
- set_background
- angle = spin ? @speed * @spin_count / 360 : 0
- angle = @spin_right ? angle : -angle
- for i in 0...item_max
- n = (i - @index) * angle_size + angle
- cx = @radius * Math.sin(n) + center_x
- cy = - @radius * Math.cos(n) + center_y
- draw_spin_graphic(i, cx, cy)
- end
- set_text
- end
- def update
- super
- update_cursor
- if @spin_count > 0
- @spin_count -= 1
- set_spin(@spin_count >= 1)
- return
- end
- update_command
- end
- def command_movable?
- return false if @spin_count > 0
- return false if (not visible or not active)
- return false if (index < 0 or index > item_max or item_max == 0)
- return false if (@opening or @closing)
- return true
- end
- def command_right
- @index = (@index + 1) % item_max
- @spin_right = true
- set_spin_count
- end
- def command_left
- @index = (@index - 1 + item_max) % item_max
- @spin_right = false
- set_spin_count
- end
- def update_command
- if command_movable?
- if Input.press?(Input::RIGHT)
- Sound.play_cursor
- Zii.turn_normal? ? command_right : command_left
- end
- if Input.press?(Input::LEFT)
- Sound.play_cursor
- Zii.turn_normal? ? command_left : command_right
- end
- end
- call_update_help
- end
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- else
- rect = Rect.new(0, 0, 24, 24)
- rect.x = center_x - rect.width / 2
- rect.y = center_y - rect.height / 2 - @radius
- self.cursor_rect = rect
- self.z = 150
- end
- end
- def help_window=(help_window)
- @help_window = help_window
- call_update_help
- end
- def call_update_help
- if self.active and @help_window != nil
- update_help
- end
- end
- def update_help
- end
- end
- class Window_LineHelp < Window_Base
- def initialize
- super(-16, 0, 544, WLH + 32)
- self.opacity = 0
- end
- def set_text(text, align = 0)
- if text != @text or align != @align
- self.contents.clear
- back_color = Color.new(0, 0, 0, 80)
- self.contents.fill_rect(0, y = 12, contents.width, WLH - y, back_color)
- self.contents.font.color = normal_color
- self.contents.draw_text(20, 0, self.width - 72, WLH, text, align)
- @text = text
- @align = align
- end
- end
- end
- class Window_ActorCommand < Window_SpinCommand
- def initialize
- s1 = ["攻击", "icon", Zii::ATTACK, true]
- s2 = [Vocab::skill,"icon", Zii::SKILL, true]
- s3 = ["防御", "icon", Zii::GUARD, true]
- s4 = ["物品", "icon", Zii::ITEM, true]
- s5 = ["逃跑", "icon", Zii::ESCAPE, $game_troop.can_escape]
- setting = {"R"=>40, "S"=>52, "G"=>"Spin40", "L"=>-12}
- super(72, 356, [s1, s2, s3, s4, s5], setting)
- self.active = false
- set_spin
- end
- def setup(actor)
- @commands[0][2] = Zii::ATTACK
- @commands[1][0] = Vocab::skill
- if actor.weapons[0] != nil
- n = actor.weapons[0].icon_index
- @commands[0][2] = n if n > 0
- end
- @commands[1][0] = actor.class.skill_name if actor.class.skill_name_valid
- self.index = 0
- set_spin
- end
- end
- class Window_PartyCommand < Window_SpinCommand
- def initialize
- s1 = [Vocab::fight, "icon", Zii::FIGHT, true]
- s2 = [Vocab::escape, "icon", Zii::ESCAPE, $game_troop.can_escape]
- setting = {"R"=>40, "S"=>52, "G"=>"Spin40", "L"=>-12}
- super(72, 356, [s1, s2], setting)
- self.active = false
- set_spin
- end
- end
- class Window_BattleStatus < Window_Selectable
- def initialize
- super(0, 230, 544, 208)
- @column_max = 1
- refresh
- self.active = false
- self.opacity = 0
- end
- def draw_neomemo7_back
- @neomemo7_clear = false
- for index in 0...@item_max
- x = index * 96
- self.contents.clear_rect(x + 72, WLH * 3, 24, 24)
- next unless Zii.battle_face?
- actor = $game_party.members[index]
- next if actor.hp <= 0
- bitmap = Cache.face(actor.face_name)
- rect = Rect.new(0, 0, 22, 22)
- rect.x = actor.face_index % 4 * 96 + 72
- rect.y = actor.face_index / 4 * 96 + 72
- self.contents.blt(x + 72, WLH * 3, bitmap, rect, 192)
- end
- end
- def draw_item(index)
- x = index * 144 + 20
- x2 = 20
- y = 15
- rect = Rect.new(x, 0, 96, 96)
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.size = 12
- actor = $game_party.members[index]
- draw_actor_state2(actor, x + 72 + 40, WLH)
- x = index * 144
- x3 = 25
- draw_actor_hp(actor, x + x2 + x3 + 6, WLH * 2 + 63, 95)
- draw_actor_mp(actor, x + x2 + x3 + 18, WLH * 3 + 52, 95)
- end
- def update_cursor
- y = 15
- if @index < 0 # ƒJ[ƒ\ƒ‹ˆÊ’u‚ª 0 –¢–ž‚Ìê‡
- self.cursor_rect.empty # ƒJ[ƒ\ƒ‹‚𖳌ø‚Æ‚·‚é
- else # ƒJ[ƒ\ƒ‹ˆÊ’u‚ª 0 ˆÈã‚Ìê‡
- #rect = Rect.new(index * 161 - 12, 45, 137, 115)
- #self.cursor_rect = rect
- end
- end
- end
- class Scene_Battle < Scene_Base
- alias :neomemo13_create_info_viewport :create_info_viewport
- def create_info_viewport
- neomemo13_create_info_viewport
- @info_viewport.rect.set(0, 0, 544, 416)
- @party_command_window.x = 800
- @status_window.x = 130
- @status_window.y = 250
- @actor_command_window.x = 440
- @actor_command_window.y = 272
- @message_window.x = 0
- @message_window.y = 10
- @message_window.opacity = 0
- #Hanzo Battle Graphics Load
- @message_skin = Sprite.new
- @message_skin.bitmap = Cache.system("Battle_Message")
- @message_skin.opacity = 0
- @message_skin.x = -400
- end
- alias :neomemo13_update_info_viewport :update_info_viewport
- def update_info_viewport
- ox = @info_viewport.ox
- neomemo13_update_info_viewport
- @info_viewport.ox = ox
- @status_window.update
- end
- alias :neomemo13_start_actor_command_selection :start_actor_command_selection
- def start_actor_command_selection
- neomemo13_start_actor_command_selection
- @actor_command_window.visible = true
- end
- alias :neomemo13_update_actor_command_selection :update_actor_command_selection
- def update_actor_command_selection
- return unless @actor_command_window.command_movable?
- neomemo13_update_actor_command_selection
- end
- alias :neomemo13_start_item_selection :start_item_selection
- def start_item_selection
- @help_window = Window_Help.new if @help_window == nil
- @help_window.visible = true
- @item_window = Window_Item.new(0, 56, 544, 232)
- @item_window.z = 1000
- @item_window.help_window = @help_window
- @actor_command_window.active = false
- end
- end
复制代码 |
|