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

Project1

 找回密码
 注册会员
搜索

如何让屏幕坐标在画面卷动前后保持一致?

查看数: 1836 | 评论数: 1 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2014-8-14 09:12

正文摘要:

回复

克莉丝 发表于 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 18:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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