赞 | 120 |
VIP | 13 |
好人卡 | 16 |
积分 | 193 |
经验 | 38692 |
最后登录 | 2024-4-24 |
在线时间 | 3074 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 19284
- 在线时间
- 3074 小时
- 注册时间
- 2013-1-11
- 帖子
- 1288
|
本帖最后由 张咚咚 于 2022-11-27 19:55 编辑
将下面这些脚本插入到你上面的脚本的下面。(不过推荐做法是建议将你的分辨率宽高改为32的整除数,然后将下面这段脚本里所有的 32.0 替换为 32)
- class Game_Map
- def setup_scroll
- @scroll_direction = 2
- @scroll_rest = 0
- @scroll_speed = 4
- @margin_x = (width - (Graphics.width / 32.0)) * 256 / 2
- @margin_y = (height - (Graphics.height / 32.0)) * 256 / 2
- end
- def scroll_down(distance)
- if loop_vertical?
- @display_y += distance
- @display_y %= @map.height * 256
- @parallax_y += distance
- else
- last_y = @display_y
- @display_y = [@display_y + distance, (height - (Graphics.height / 32.0)) * 256].min
- @parallax_y += @display_y - last_y
- end
- end
- def scroll_right(distance)
- if loop_horizontal?
- @display_x += distance
- @display_x %= @map.width * 256
- @parallax_x += distance
- else
- last_x = @display_x
- @display_x = [@display_x + distance, (width - (Graphics.width / 32.0)) * 256].min
- @parallax_x += @display_x - last_x
- end
- end
- end
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ● 常量
- #--------------------------------------------------------------------------
- CENTER_X = (Graphics.width / 2 - 16) * 8 # 画面中央 X 座标 * 8
- CENTER_Y = (Graphics.height / 2 - 16) * 8 # 画面中央 Y 座标 * 8
- def center(x, y)
- display_x = x * 256 - CENTER_X # 计算座标
- unless $game_map.loop_horizontal? # 非横向回圈的场合
- max_x = ($game_map.width - (Graphics.width / 32.0)) * 256 # 计算最大值
- display_x = [0, [display_x, max_x].min].max # 校正座标
- end
- display_y = y * 256 - CENTER_Y # 计算座标
- unless $game_map.loop_vertical? # 非横向回圈的场合
- max_y = ($game_map.height - (Graphics.height / 32.0)) * 256 # 计算最大值
- display_y = [0, [display_y, max_y].min].max # 校正座标
- end
- $game_map.set_display_pos(display_x, display_y) # 改变地图位置
- end
- end
- class Spriteset_Map
- def create_viewports
- @viewport1 = Viewport.new(0, 0, Graphics.width, Graphics.height)
- @viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height)
- @viewport3 = Viewport.new(0, 0, Graphics.width, Graphics.height)
- @viewport2.z = 50
- @viewport3.z = 100
- end
- end
复制代码 |
|