| 赞 | 168 |
| VIP | |
| 好人卡 | |
| 积分 | 229 |
| 经验 | |
| 最后登录 | 2025-4-1 |
| 在线时间 | 8598 小时 |
- 梦石
- 0
- 星屑
- 22879
- 在线时间
- 8598 小时
- 注册时间
- 2011-12-31
- 回帖
- 3270
|
发表于 2015-2-17 10:16:15
|
显示全部楼层
本帖最后由 tseyik 于 2015-2-17 10:23 编辑
VX and VXAce使用XP行走图
xpP行走图 名前加$
例: 001-Fighter01.png -> $xp001-Fighter01.png
這脚本可用於 VX /VXAce.- #==============================================================================
- # ** MSX - XP Characters on VX/VXAce
- #==============================================================================
- # Author: Melosx
- # Notes translated by ShinGamix
- # http://www.rpgmakervxace.net/index.php?/user/1272-shingamix/
- # Version: 1.0
- # Compatible with VX and VXAce
- #
- #==============================================================================
- # * Description
- # -----------------------------------------------------------------------------
- # This script allows you to use xp in vx chara simply inserting the tag
- # $xp
- # Before the name of the file.
- # You can then use the normal VX / VXAce along with those of XP.
- #
- #==============================================================================
- # * Instructions
- # -----------------------------------------------------------------------------
- # Place the script under Materials and above Main. Add to chara of XP
- # $xp before the tag name.
- #
- #==============================================================================
- #==============================================================================
- # ** Sprite_Character
- #==============================================================================
- class Sprite_Character < Sprite_Base
- def update_bitmap
- if @tile_id != @character.tile_id or
- @character_name != @character.character_name or
- @character_index != @character.character_index
- @tile_id = @character.tile_id
- @character_name = @character.character_name
- @character_index = @character.character_index
- if @tile_id > 0
- sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
- sy = @tile_id % 256 / 8 % 16 * 32;
- self.bitmap = tileset_bitmap(@tile_id)
- self.src_rect.set(sx, sy, 32, 32)
- self.ox = 16
- self.oy = 32
- else
- self.bitmap = Cache.character(@character_name)
- sign = @character_name[/^[!$]./]
- if sign != nil and sign.include?(')
- @cw = bitmap.width / 3
- @ch = bitmap.height / 4
- else
- @cw = bitmap.width / 12
- @ch = bitmap.height / 8
- end
- if @character_name != nil and @character_name.include?('$xp')
- @cw = bitmap.width / 4
- @ch = bitmap.height / 4
- end
- self.ox = @cw / 2
- self.oy = @ch
- end
- end
- end
-
- def update_src_rect
- if @character_name != nil and @character_name.include?('$xp')
- if @tile_id == 0
- pattern = @character.pattern > 0 ? @character.pattern - 1 : 3
- sx = pattern * @cw
- sy = (@character.direction - 2) / 2 * @ch
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- else
- if @tile_id == 0
- index = @character.character_index
- pattern = @character.pattern < 3 ? @character.pattern : 1
- sx = (index % 4 * 3 + pattern) * @cw
- sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- end
- end
- end
- #==========================================================================
- # ** Window_Base
- #==========================================================================
- class Window_Base < Window
- def draw_character(character_name, character_index, x, y)
- return if character_name == nil
- bitmap = Cache.character(character_name)
- sign = character_name[/^[!$]./]
- if character_name != nil and character_name.include?('$xp')
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- n = character_index
- src_rect = Rect.new(0, 0, cw, ch)
- else
- if sign != nil and sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = character_index
- src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
- end
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- end
复制代码 另一個,
・{p=n}
nは整数で、キャラクターの画像名に{p=4}のように入れてください。
例 $001-Fighter01.png → $001-Fighter01{p=4}.png
・パターン(コマ)数拡張
キャラクターの画像は各方向につき3コマ(足踏みの演出)で構成されていますが、このコマ数を変えることができます。
画像名に{p=n}が入っているとコマ数がnになります。
{p=4}だとXPのキャラクター画像をそのまま使用できます。
{p=3}ならコマ数はデフォルトと同じですが、アニメーション方式(下を参照)だけが変わります。
・キャラクターのアニメーション方式
VXAceのRTP規格では3コマの内、2コマ目が「足を揃えた状態」で1・3コマ目が「片足を出した状態」です。
デフォルトではこのコマのアニメーションを
2コマ目 3コマ目 2コマ目 1コマ目 2→3→2→1→2→3→2→
足を揃える 左足を出す 足を揃える 右足を出す 揃 左 揃 右 揃 左 揃
という風にして足踏みさせています。
画像名に{p=n}が入っているとこのアニメーション方式が変わり、例えば{p=5}なら
1→2→3→4→5→1→2→3→4→5→1→
という風に1コマ目から始まって、最後まで行ったらまた1コマ目に戻るようになります。
[pre lang="ruby"]#==============================================================================
# RGSS3_キャラ画像コマ数拡張
# 2012/07/10公開
# C Winter (http://ccwinter.blog.fc2.com/)
#==============================================================================
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● キャラクターのビットマップを設定
#--------------------------------------------------------------------------
def set_character_bitmap
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
max_pattern = @character_name =~ /{p=(\d+)}/i ? $1.to_i : 3
if sign && sign.include?('$')
@cw = bitmap.width / max_pattern
@ch = bitmap.height / 4
else
@cw = bitmap.width / (max_pattern * 4)
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
end
#--------------------------------------------------------------------------
# ● 転送元矩形の更新
#--------------------------------------------------------------------------
def update_src_rect
if @tile_id == 0
index = @character.character_index
if @character_name =~ /{p=(\d+)}/i
max_pattern = $1.to_i
ori_pattern = 0
else
max_pattern = 3
ori_pattern = 1
end
pattern = @character.pattern < max_pattern ? @character.pattern : ori_pattern
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
#==============================================================================
# ■ Game_CharacterBase
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# ● アニメパターンの更新
#--------------------------------------------------------------------------
def update_anime_pattern
max_pattern = @character_name =~ /{p=(\d+)}/i ? $1.to_i : 4
if !@step_anime && @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % max_pattern
end
end
end[/pre] |
|