设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3364|回复: 4
打印 上一主题 下一主题

[已经过期] 改了移动速度,移动的时候事件图会偏移一个像素点

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
366 小时
注册时间
2009-7-14
帖子
124
跳转到指定楼层
1
发表于 2013-3-15 15:05:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
用事件指令 脚本:@move_speed = 3.5 改了主角的移动速度,但是移动的时候当镜头跟着主角卷动,事件的图会偏移一个像素点,就好像没跟上地图的卷动速度一样,貌似只要移动速度那个系数不是整数带小数就会这样,我是用事件图做景物的,这样感觉就好像错位了,请问有办法解决吗?

Lv3.寻梦者

梦石
0
星屑
4881
在线时间
425 小时
注册时间
2019-10-22
帖子
666
2
发表于 2020-8-15 11:14:59 | 只看该作者
7年后的我 遇到了同样的问题 搜索到了这个帖子
















回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24389
在线时间
5061 小时
注册时间
2016-3-8
帖子
1622
3
发表于 2020-8-15 12:04:03 | 只看该作者
坏数据 发表于 2020-8-15 11:14
7年后的我 遇到了同样的问题 搜索到了这个帖子
  1. ##------
  2. ## Display rounding error fix created by Neon Black.
  3. ##
  4. ## When certain slow display panning speeds are used, events will improperly
  5. ## round floating values to determine their position on screen.  This causes
  6. ## them to appear off from the tilemap by a single pixel.  Though minor this is
  7. ## noticable.  This snippet fixes this behaviour.
  8. ##
  9. ## This snippet may be used in any project.
  10. ##
  11. ## -- Original Topic:
  12. ## http://forums.rpgmakerweb.com/index.php?/topic/17448-event-jitter-fix-display-rounding-error-fix
  13. ##------
  14. class Game_Map ## Rounds X and Y display values DOWN so the nearest 32 is found.
  15.   def display_x
  16.     (@display_x * 32).floor.to_f / 32
  17.   end
  18.   
  19.   def display_y
  20.     (@display_y * 32).floor.to_f / 32
  21.   end
  22.   
  23.   def adjust_x(x)
  24.     if loop_horizontal? && x < display_x - (width - screen_tile_x) / 2
  25.       x - display_x + @map.width
  26.     else
  27.       x - display_x
  28.     end
  29.   end
  30.   
  31.   def adjust_y(y)
  32.     if loop_vertical? && y < display_y - (height - screen_tile_y) / 2
  33.       y - display_y + @map.height
  34.     else
  35.       y - display_y
  36.     end
  37.   end
  38. end
复制代码

点评

非常好,修复了,这里是重新计算了@display_x @display_y 的值 并且换到adjust_x(x) adjust_y(y)里面,event调用$game_map.adjust_x(x)的时候拿到的就是正确的值  发表于 2020-8-15 20:13

评分

参与人数 1+1 收起 理由
坏数据 + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-5 17:58

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表