Project1
标题:
战斗选择目标敌人问题
[打印本页]
作者:
仙芋
时间:
2010-8-13 15:52
标题:
战斗选择目标敌人问题
一般选择目标敌人时按 ESC 可以取消选取
可是当我的箭头在右面的敌人,再按 ESC ,敌斗选单便消失了
什么都不能选择,卡住了
若箭头在最左面的敌人,按 ESC 却可以取消选取,没有问题
如何解决卡住了的情况?
图解:
当我的箭头在右面的敌人
battle_a.PNG
(545.9 KB, 下载次数: 2)
下载附件
保存到相册
2010-8-13 15:50 上传
按 ESC 后,敌斗选单便消失了,不见了选择"攻击","仙术"的选项,卡住了
battle_b.PNG
(622.57 KB, 下载次数: 2)
下载附件
保存到相册
2010-8-13 15:50 上传
作者:
a849797000
时间:
2010-8-13 15:53
你按右下角的0看看
作者:
仙芋
时间:
2010-8-13 15:58
回复
a849797000
的帖子
键盘上的0?
没有反应~
作者:
仙芋
时间:
2010-8-17 14:09
没有人?
作者:
fux2
时间:
2010-8-21 19:02
右下角的0等于X键,别听LS胡咧咧
应该是脚本没有设置按B的情况
你打开脚本看看update_command这里应该有设置
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换的地图画面
$scene = Scene_Map.new
return
end
复制代码
这个是原版的代码,你可以照着格式改
作者:
仙芋
时间:
2010-8-21 19:12
回复
fux2
的帖子
是在哪个脚本?
作者:
BBBBB6
时间:
2010-8-21 19:17
...当然就是你用的脚本。。。
作者:
仙芋
时间:
2010-8-21 19:37
回复
BBBBB6
的帖子
这个吗?
没有 update_command
#==============================================================================
# ■ Arrow_Enemy
#------------------------------------------------------------------------------
# 选择敌人的箭头光标。本类继承 Arrow_Base
# 类。
#==============================================================================
class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# ● 获取光标指向的敌人
#--------------------------------------------------------------------------
def enemy
return $game_troop.enemies[@index]
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 如果指向不存在的敌人就离开
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
# 光标右
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# 光标左
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# 设置活动块坐标
if self.enemy != nil
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y
end
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
# 帮助窗口显示敌人的名字与状态
end
end
复制代码
作者:
fux2
时间:
2010-8-22 14:26
回复
仙芋
的帖子
没有自己添加
作者:
仙芋
时间:
2010-8-22 15:21
回复
fux2
的帖子
问题原来不在刚才的脚本
是在这个
可是我找不出什么问题
#==============================================================================
#==============================================================================
module Momo_IconCommand
# 图标名称设定
ATTACK_ICON_NAME = "Attack" # 攻击
SKILL_ICON_NAME = "Skill" # 特技
GUARD_ICON_NAME = "Guard" # 防御
ITEM_ICON_NAME = "Thing" # 物品
# X坐标修正
X_PLUS = -320
# Y坐标修正
Y_PLUS = -100
# 选择时图标的动作
# 0:静止 1:放大
SELECT_TYPE = 0
# 闪烁时光芒的颜色
FLASH_COLOR = Color.new(255, 255, 255, 128)
# 闪烁时间
FLASH_DURATION = 10
# 闪烁间隔
FLASH_INTERVAL = 20
# 是否写出文字的名称
COM_NAME_DROW = false
# 文字名称是否移动
COM_NAME_MOVE = false
# 文字内容
ATTACK_NAME = "攻击" # 攻击
SKILL_NAME = "特技" # 特技
GUARD_NAME = "防御" # 防御
ITEM_NAME = "物品" # 物品
# 文字颜色
COM_NAME_COLOR = Color.new(255, 255, 255, 255)
# 文字坐标修正
COM_NAME_X_PLUS = 0
COM_NAME_Y_PLUS = 0
end
class Window_CommandIcon < Window_Selectable
attr_accessor :last_index
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, commands)
super(x, y, 37, 37)
# ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
self.windowskin = RPG::Cache.windowskin("")
@item_max = commands.size
@commands = commands
@column_max = commands.size
@index = 0
@last_index = nil
@name_sprite = nil
@sprite = []
refresh
end
def dispose
super
for sprite in @sprite
sprite.dispose unless sprite.nil?
end
@name_sprite.dispose unless @name_sprite.nil?
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@name_sprite.dispose unless @name_sprite.nil?
for sprite in @sprite
sprite.dispose unless sprite.nil?
end
@name_sprite = nil
draw_com_name if Momo_IconCommand::COM_NAME_DROW
@sprite = []
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 项目の描画
#--------------------------------------------------------------------------
def draw_item(index)
@sprite[index] = Sprite_Icon.new(nil, @commands[index])
@sprite[index].z = self.z + 1
end
def draw_com_name
@name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
end
# 更新
def update
super
#--------------------------------------------------------------------------
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index = 2
end
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index = 0
end
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index = 3
end
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index = 1
end
#--------------------------------------------------------------------------
icon_update
com_name_update if Momo_IconCommand::COM_NAME_DROW
if move_index?
@last_index = self.index
end
end
# アイコンの更新
def icon_update
qx = 25
qy = 385
for i in
[email protected]
@sprite[i].active = (self.index == i)
@sprite[0].x = 40 +qx
@sprite[0].y = -15 +qy
@sprite[1].x = 0 + qx
@sprite[1].y = 23 + qy
@sprite[2].x = 40 + qx
@sprite[2].y = 59 + qy
@sprite[3].x = 81 + qx
@sprite[3].y = 23 + qy
#@sprite[i].x = self.x + i * 56
#@sprite[i].y = self.y + 0
@sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
@sprite[i].visible = self.visible
@sprite[i].update
end
end
# コマンドネームの更新
def com_name_update
if move_index?
@name_sprite.name = get_com_name
end
@name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
@name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
@name_sprite.z = self.z + 1
@name_sprite.active = self.active
@name_sprite.visible = self.visible
@name_sprite.update
end
def get_com_name
make_name_set if @name_set.nil?
name = @name_set[self.index]
name = "" if name.nil?
return name
end
def make_name_set
@name_set = []
@name_set[0] = Momo_IconCommand::ATTACK_NAME
@name_set[1] = Momo_IconCommand::SKILL_NAME
@name_set[2] = Momo_IconCommand::GUARD_NAME
@name_set[3] = Momo_IconCommand::ITEM_NAME
end
def move_index?
return self.index != @last_index
end
def need_reset
@name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
end
end
# アイコン用スプライト
class Sprite_Icon < Sprite
attr_accessor :active
attr_accessor :icon_name
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport, icon_name)
super(viewport)
@icon_name = icon_name
@last_icon = @icon_name
@count = 0
self.bitmap = RPG::Cache.icon(@icon_name)
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height / 2
@active = false
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @icon_name != @last_icon
@last_icon = @icon_name
self.bitmap = RPG::Cache.icon(@icon_name)
end
if @active
@count += 1
case Momo_IconCommand::SELECT_TYPE
when 0
icon_flash
when 1
icon_zoom
end
@count = 0 if @count == 20
else
icon_reset
end
end
def icon_flash
if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
end
end
def icon_zoom
case @count
when 1..10
zoom = 1.0 + @count / 10.0
when 11..20
zoom = 2.0 - (@count - 10) / 10.0
end
self.zoom_x = zoom
self.zoom_y = zoom
end
def icon_reset
@count = 0
self.zoom_x = 1.0
self.zoom_y = 1.0
end
end
# コマンドネーム用スプライト
class Sprite_Comm_Name < Sprite
attr_accessor :active
attr_accessor :name
attr_accessor :need_reset
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport, name)
super(viewport)
@name = name
@last_name = nil
@count = 0
@x_plus = 0
@opa_plus = 0
@need_reset = false
@active = false
self.bitmap = Bitmap.new(160, 32)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @active
if need_reset?
@need_reset = false
@last_name = @name
text_reset
end
move_text if Momo_IconCommand::COM_NAME_MOVE
end
end
def move_text
@count += 1
@x_plus = [@count * 8, 80].min
self.y = 0
self.x = self.x - 300 - @x_plus
self.opacity = @count * 25
end
def text_reset
@count = 0
@x_plus = 0
self.bitmap.clear
self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
self.bitmap.draw_text(0, 0, 160, 32, @name)
end
def need_reset?
return (@name != @last_name or @need_reset)
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● プレバトルフェーズ开始
#--------------------------------------------------------------------------
alias scene_battle_icon_command_start_phase1 start_phase1
def start_phase1
com1 = Momo_IconCommand::ATTACK_ICON_NAME
com2 = Momo_IconCommand::SKILL_ICON_NAME
com3 = Momo_IconCommand::GUARD_ICON_NAME
com4 = Momo_IconCommand::ITEM_ICON_NAME
@actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
$fff = 0
@actor_command_window.active = false
# @actor_command_window.visible = false
@actor_command_window.update
scene_battle_icon_command_start_phase1
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
def phase3_setup_command_window
scene_battle_icon_command_phase3_setup_command_window
# アクターコマンドウィンドウの位置を设定
@actor_command_window.x = 1000
@actor_command_window.y = 1000
@actor_command_window.need_reset
end
def command_window_actor_x(index)
$game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
end
def command_window_actor_y(index)
$game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
end
end
#==============================================================================
#==============================================================================
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1