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

Project1

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

[已经解决] 如何让屏幕坐标在画面卷动前后保持一致?

[复制链接]

Lv2.观梦者

梦石
0
星屑
290
在线时间
3599 小时
注册时间
2012-2-29
帖子
3385

黄金编剧

跳转到指定楼层
1
发表于 2014-8-14 09:12:27 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x

如图,用画面XY显示图片,在角色移动导致画面卷动时图片会发生偏移,偏移方向是角色移动的方向
有使该图片不偏移的方法么?(改进方法 其他显示方法等皆可)
范例在此
乱晃范例.zip (204.96 KB, 下载次数: 28)

评分

参与人数 1星屑 +35 收起 理由
︶ㄣ牛排ぶ + 35 手动认可奖励

查看全部评分

简化 高效 简约 便捷,为用户体验而思考。

Lv1.梦旅人

梦石
0
星屑
68
在线时间
585 小时
注册时间
2013-5-25
帖子
1524
2
发表于 2014-8-14 10:11:32 | 只看该作者
本帖最后由 克莉丝 于 2014-8-14 10:31 编辑

$game_screen.pictures[n].fix_to_map
之后图片会随地图滚动不需要用并行事件显示...
$game_screen.pictures[n].fix_to_event(event_id)
与事件固定

事件\脚本见下


  1. class Game_Picture
  2.   def fix_to_map
  3.     @fix_to_map = [$game_map.display_x / 4,$game_map.display_y / 4]
  4.   end
  5.   def fix_to_map?
  6.     @fix_to_map
  7.   end
  8.   def fix_to_event(event_id)
  9.     @fix_to_event = [$game_map.map_id,event_id]
  10.   end
  11.   def fix_to_event?
  12.     @fix_to_event
  13.   end
  14.   alias show_crysse2014814 show
  15.   def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  16.     show_crysse2014814(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  17.     @fix_to_map = false
  18.     @fix_to_event = false
  19.   end
  20. end
  21. class Sprite_Picture < Sprite
  22.   alias update_crysse2014814 update
  23.   def update
  24.     update_crysse2014814
  25.     if $scene.is_a?(Scene_Map) and @picture.fix_to_map?
  26.       self.x = @picture.x - $game_map.display_x / 4 + @picture.fix_to_map?[0]
  27.       self.y = @picture.y - $game_map.display_y / 4 + @picture.fix_to_map?[1]
  28.     end
  29.     if $scene.is_a?(Scene_Map) and @picture.fix_to_event?
  30.       return if @picture.fix_to_event?[0] != $game_map.map_id
  31.       self.x = @picture.x+$game_map.events[@picture.fix_to_event?[1]].screen_x
  32.       self.y = @picture.y+$game_map.events[@picture.fix_to_event?[1]].screen_y
  33.     end
  34.   end
  35. end
复制代码

评分

参与人数 4星屑 +290 梦石 +1 收起 理由
︶ㄣ牛排ぶ + 1 认可答案
VIPArcher + 30 鸟触出没,XP区真的不发好人卡么。.
·雾逝者· + 60 多谢
RyanBern + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 16:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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