| 赞 | 40 |
| VIP | |
| 好人卡 | |
| 积分 | 50 |
| 经验 | |
| 最后登录 | 2026-9-17 |
| 在线时间 | 5234 小时 |
八宝粥的基叔
- 梦石
- 0
- 星屑
- 4957
- 在线时间
- 5234 小时
- 注册时间
- 2009-4-29
- 回帖
- 14054

|
发表于 2013-3-20 18:42:23
|
显示全部楼层
本帖最后由 protosssonny 于 2013-3-21 11:04 编辑
教程:http://rpg.blue/thread-300206-1-1.html
范例:
冰面滑行系统.rar
(240.74 KB, 下载次数: 81)
截图:
脚本:
[pre lang="ruby" line="1"]#==============================================================================
# ★ 冰面滑动
#------------------------------------------------------------------------------
# 作者:protosssonny
# 转载请保留脚本来源:www.66RPG.com
#--------------------------------------------------------------------------
# 请在下面设定冰面图块的ID
Ice_Tile = [1537,1538,1539]
# 可以在事件脚本中输入以下命令来查看当前角色脚下的图块ID,以便确定冰面图块:
# $game_map.show_tile_id
#==============================================================================
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 处理地图的类。包含卷动以及可以通行的判断功能。本类的实例请参考 $game_map 。
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 判断冰面
# x : X 坐标
# y : Y 坐标
#--------------------------------------------------------------------------
def ice?(x, y)
return false unless valid?(x, y)
return true if Ice_Tile.include?($game_map.data[x, y, 0])
end
#--------------------------------------------------------------------------
# ● 显示当前图块ID (测试用的脚本命令)
#--------------------------------------------------------------------------
def show_tile_id
p $game_map.data[$game_player.x, $game_player.y, 0]
end
end
#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
# 处理主角的类。事件启动的判定、以及地图的滚动等功能。
# 本类的实例请参考 $game_player。
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
last_real_x = @real_x
last_real_y = @real_y
last_moving = moving?
if $game_map.ice?(@x, @y) # 在冰上移动
@walk_anime = false
move_on_ice
else
@walk_anime = true
end
move_by_input
super
update_scroll(last_real_x, last_real_y)
update_vehicle
update_nonmoving(last_moving)
end
#--------------------------------------------------------------------------
# ● 方向键移动处理
#--------------------------------------------------------------------------
def move_on_ice
return unless movable?
return if $game_map.interpreter.running?
return if @move_failed
case self.direction
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
end
#--------------------------------------------------------------------------
# ● 判断是否奔跑中
#--------------------------------------------------------------------------
def dash?
return false if @move_route_forcing
return false if $game_map.disable_dash?
return false if in_vehicle?
return Input.press?(Input::A) unless $game_map.ice?(@x, @y) #加本行即可
end
[/pre] |
评分
-
查看全部评分
|