赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 0 |
最后登录 | 2020-5-5 |
在线时间 | 2 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 65
- 在线时间
- 2 小时
- 注册时间
- 2008-11-8
- 帖子
- 4
|
re:主题:《VX中8*4如何实现》
以下引用snstar2006于2009-3-16 12:18:40的发言:
我记得很清楚...置顶帖里面有脚本....
老大,你指的是这个吗:
Q:VX行走图的格式为何?
A:VX 单张人物行走图格式:
横排三祯,分别是: 右脚前、双脚合并、左脚前
直列四祯,分别是: 面向下、面向左、面向右、面向上
没有限制大小,但是每格的大小必须要一致
整张图的宽就是3格的宽度总和、高就是4格的高度总和
若是单张的话,应用时文件名称前面要带 !$
若是拼起来的话,横排4个单张行走图(按照上面格式),直列2个,这时就不需要带 !$
我把8*3的脚本发到下面,你教我改哪里好吗?我真的很仔细地研究过,好像就是设置了键盘按键和什么东西居中。别的打死我也看不懂了!
- #==============================================================================
- # ■ Game_Character
- #==============================================================================
- class Game_Character
- #--------------------------------------------------------------------------
- # ● 八方向
- #--------------------------------------------------------------------------
- def direction_8dir
- return @direction
- end
- #--------------------------------------------------------------------------
- # ● 变成指定方向
- # direction : 方向
- #--------------------------------------------------------------------------
- alias set_direction_8fangxiang set_direction
- def set_direction(direction)
- last_dir = @direction
- set_direction_8fangxiang(direction)
- if !@direction_fix && direction != 0
- @direction_8dir = direction
- end
- end
- #--------------------------------------------------------------------------
- # ● 向左下移动
- #--------------------------------------------------------------------------
- alias move_lower_left_8fangxiang move_lower_left
- def move_lower_left
- move_lower_left_8fangxiang
- @direction_8dir = 1 unless @direction_fix
- end
- #--------------------------------------------------------------------------
- # ● 向右下移动
- #--------------------------------------------------------------------------
- alias move_lower_right_8fangxiang move_lower_right
- def move_lower_right
- move_lower_right_8fangxiang
- @direction_8dir = 3 unless @direction_fix
- end
- #--------------------------------------------------------------------------
- # ● 向左上移动
- #--------------------------------------------------------------------------
- alias move_upper_left_8fangxiang move_upper_left
- def move_upper_left
- move_upper_left_8fangxiang
- @direction_8dir = 7 unless @direction_fix
- end
- #--------------------------------------------------------------------------
- # ● 向右上移动
- #--------------------------------------------------------------------------
- alias move_upper_right_8fangxiang move_upper_right
- def move_upper_right
- move_upper_right_8fangxiang
- @direction_8dir = 9 unless @direction_fix
- end
- end
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- def decrease_steps
- @steps -= 1
- end
- end
- #==============================================================================
- # ■ Game_Player
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ●八方向
- #--------------------------------------------------------------------------
- def direction_8dir
- @direction_8dir = @direction if @direction_8dir == nil
- return @direction_8dir
- end
- #--------------------------------------------------------------------------
- # ● 八方向按键
- #--------------------------------------------------------------------------
- def move_by_input
- return unless movable?
- return if $game_map.interpreter.running?
- last_steps = $game_party.steps
- case Input.dir8
- when 1; move_down; move_left; @direction = 2
- when 2; move_down
- when 3; move_down; move_right; @direction = 6
- when 4; move_left
- when 6; move_right
- when 7; move_up; move_left; @direction = 4
- when 8; move_up
- when 9; move_up; move_right; @direction = 8
- else; return
- end
- @direction_8dir = Input.dir8
- # 斜方向移动正确步数计算
- if $game_party.steps - last_steps == 2
- $game_party.decrease_steps
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 移动更新
- #--------------------------------------------------------------------------
- def update_move
- distance = 2 ** @move_speed
- if dash?
- distance *= 2
- end
- distance = Integer(distance)
- @real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
- @real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
- @real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
- @real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
- update_bush_depth unless moving?
- if @walk_anime
- @anime_count += 1.5
- elsif @step_anime
- @anime_count += 1
- end
- end
- end
- #==============================================================================
- # ■ Sprite_Character
- #==============================================================================
- class Sprite_Character < Sprite_Base
-
- ANIME_TABLE = { 1=>2, 3=>6, 7=>4, 9=>8 }
- #--------------------------------------------------------------------------
- # ● 更新位图
- #--------------------------------------------------------------------------
- alias update_bitmap_8fangxiang update_bitmap
- def update_bitmap
- name_changed = (@character_name != @character.character_name)
- update_bitmap_8fangxiang
- if @tile_id > 0
- @enable_slant = false
- return
- end
- return unless name_changed
- @enable_slant = true
- begin
- @character_name_slant = @character_name + "#"
- Cache.character(@character_name_slant)
- rescue
- @enable_slant = false
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新传送矩形
- #--------------------------------------------------------------------------
- alias update_src_rect_8fangxiang update_src_rect
- def update_src_rect
- return if @tile_id > 0
- if @enable_slant
- update_src_rect_for_slant
- else
- update_src_rect_8fangxiang
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新斜方向传送矩形
- #--------------------------------------------------------------------------
- def update_src_rect_for_slant
- index = @character.character_index
- pattern = @character.pattern < 8 ? @character.pattern : 1
- sx = (index % 4 * 3 + pattern) * @cw
- dir = @character.direction_8dir
- case dir % 2
- when 0 # 上下左右
- if @last_slant
- self.bitmap = Cache.character(@character_name)
- @last_slant = false
- end
- else
- unless @last_slant
- self.bitmap = Cache.character(@character_name_slant)
- @last_slant = true
- end
- dir = ANIME_TABLE[dir]
- end
- sy = (index / 4 * 4 + (dir - 2) / 2) * @ch
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- end
复制代码 |
|