Project1
标题:
人物行走帧的问题,懂脚本的进来!
[打印本页]
作者:
第一统帅
时间:
2012-4-20 13:23
标题:
人物行走帧的问题,懂脚本的进来!
不好意思,我又发帖了,这几天有好多问题。~~问题是这样的:我想在事件里插入脚本,可以随时改变人物的行走图的帧数。只用事件,或在脚本里加个变量之类的,然后用事件调用即可。帮忙写个脚本或提个方法。本人只精通事件不会脚本。~~谢谢,本人感激不尽! dsu_plus_rewardpost_czw
作者:
吉井明久
时间:
2012-4-20 15:24
Sprite_Character 里面有一行:
@cw = bitmap.width / 4
复制代码
改成这样:
@cw = bitmap.width / ((framecount = $game_variables[101]) == 0 ? 4 : framecount)
复制代码
101 是控制用的变量号。
之后在地图上改了 101 后,
用此事件脚本一下。
$scene = $scene.class.new
复制代码
更新地图显示好了。
作者:
吉井明久
时间:
2012-4-20 19:59
本帖最后由 吉井明久 于 2012-4-20 21:02 编辑
本楼属于故意连贴,旨在分享另一种方法。
class Game_Character
def update
if jumping?
update_jump
elsif moving?
update_move
else
update_stop
end
if @anime_count > 18 - @move_speed * 2
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % character_frame
end
@anime_count = 0
end
if @wait_count > 0
@wait_count -= 1
return
end
if @move_route_forcing
move_type_custom
return
end
if @starting or lock?
return
end
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
case @move_type
when 1
move_type_random
when 2
move_type_toward_player
when 3
move_type_custom
end
end
end
def character_frame
@character_frame if @old_character_name == @character_name
@character_frame = @character_name[/\[(\d*)f\]/] ? $1.to_i : 4
end
end
class Sprite_Character
def update
super
if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue)
@cw = bitmap.width / @character.character_frame
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
复制代码
插入后,行走图帧数将由文件名决定。
@end55rpg
在文件名内加入 [6f] 代表六帧。
文件名的任意位置都可以噢。
如此就可以使用 更改角色图像 功能。
作者:
第一统帅
时间:
2012-4-21 13:37
谢了
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1