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

Project1

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

[RMVX发布] [FSL]窗口滑動效果

[复制链接]

Lv2.观梦者

天仙

梦石
0
星屑
610
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

跳转到指定楼层
1
发表于 2011-1-22 12:09:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 雪流星 于 2011-1-21 22:16 编辑

作另一个系统的时候,为了让窗口滑动,顺便制作出来的副产品......
使用说明:
创建窗口之后,可以使用调整窗口的座标,并且将窗口滑动到指定位置。
可用于制作华丽菜单显示效果
* 窗口.in(方向[, 移动距离])
    方向可以为 2(下), 4(左), 6(右), 8(上)
    移动距离默认为 10
   将窗口滑动至画面外。

* 窗口.out(方向[, 移动距离])
    方向可以为 2(下), 4(左), 6(右), 8(上)
    移动距离默认为 10
   将窗口由画面外滑动至原位。

* 窗口.move_to(目标 X 座标, 目标 Y 座标[, 移动距离])
    移动距离默认为 10
   将窗口滑动至指定座标。

  1. #==============================================================================
  2. # ■ [VX] 窗口滑动
  3. #     [VX] WindowSlide
  4. #----------------------------------------------------------------------------
  5. # 使用说明:
  6. # 创建窗口之后,可以使用调整窗口的座标,并且将窗口滑动到指定位置。
  7. # 可用于制作华丽菜单显示效果
  8. # * 窗口.in(方向[, 移动距离])
  9. #     方向可以为 2(下), 4(左), 6(右), 8(上)
  10. #     移动距离默认为 10
  11. #    将窗口滑动至画面外。
  12. #
  13. # * 窗口.out(方向[, 移动距离])
  14. #     方向可以为 2(下), 4(左), 6(右), 8(上)
  15. #     移动距离默认为 10
  16. #    将窗口由画面外滑动至原位。
  17. #
  18. # * 窗口.move_to(目标 X 座标, 目标 Y 座标[, 移动距离])
  19. #     移动距离默认为 10
  20. #    将窗口滑动至指定座标。
  21. #----------------------------------------------------------------------------
  22. #    更新作者: 雪流星(Snstar2006)
  23. #    许可协议: FSL
  24. #    项目版本: 1.0.1
  25. #----------------------------------------------------------------------------
  26. #    - *1.0.1* (2011-01-21) By 雪流星(Snstar2006)
  27. #      *修改算法,省去计算根号的步骤,稍微提高效率
  28. #    - *1.0.0* (2011-01-21) By 雪流星(Snstar2006)
  29. #      *初版
  30. #==============================================================================
  31. $fscript = {} if $fscript == nil
  32. $fscript["WindowSlide"] = "1.0.0"

  33. class Window_Base < Window
  34.   alias move_window_initialize initialize
  35.   def initialize(x, y, width, height)
  36.     move_window_initialize(x, y, width, height)
  37.     @permanent_x = x
  38.     @permanent_y = y
  39.   end
  40.   def in(direction, step=10)
  41.     case direction
  42.     when 2
  43.       move_to(self.x, -self.height, step)
  44.     when 4
  45.       move_to(-self.width, self.y, step)
  46.     when 6
  47.       move_to(Graphics.width + self.width, self.y, step)
  48.     when 8
  49.       move_to(self.x, Graphics.height + self.height, step)
  50.     end
  51.     Graphics.wait(1)
  52.   end
  53.   def out(direction, step=10)
  54.     case direction
  55.     when 2, 8
  56.       move_to(self.x, @permanent_y, step)
  57.     when 4, 6
  58.       move_to(@permanent_x, self.y, step)
  59.     end
  60.   end
  61.   def move_to(dest_x, dest_y, move_step=10)
  62.     dx = dest_x - self.x
  63.     dy = dest_y - self.y
  64.     if dx == 0
  65.       dy_step = move_step
  66.       dx_step = 0
  67.     elsif dy == 0
  68.       dx_step = move_step
  69.       dy_step = 0
  70.     else
  71.       max_distance_sq = dx**2+dy**2
  72.       angle = Math.atan(dy.abs/dx.abs)
  73.       dy_step = move_step*Math.sin(angle)
  74.       dx_step = max_distance_sq - dy_step**2
  75.     end
  76.     while (self.x != dest_x || self.y != dest_y)
  77.       if dx > 0
  78.         self.x = [self.x + dx_step, dest_x].min
  79.       else
  80.         self.x = [self.x - dx_step, dest_x].max
  81.       end
  82.       if dy > 0
  83.         self.y = [self.y + dy_step, dest_x].min
  84.       else
  85.         self.y = [self.y - dy_step, dest_x].max
  86.       end
  87.       Graphics.wait(1)
  88.     end
  89.   end
  90. end
复制代码

评分

参与人数 1星屑 +6 +2 收起 理由
夕阳武士 + 6 + 2 凑整数= =

查看全部评分

VA脚本开工中...
偷窃脚本1.0 - 已完成

Lv1.梦旅人

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
帖子
12326

贵宾第6届短篇游戏比赛季军

2
发表于 2011-1-22 16:15:05 | 只看该作者
又有好东西了!!谢谢楼主分享
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1050
在线时间
1564 小时
注册时间
2008-7-30
帖子
4418

贵宾

3
发表于 2011-1-31 00:45:46 | 只看该作者
本帖最后由 DeathKing 于 2011-1-31 01:20 编辑

这个才是实用的东西啊,支持一个。
另外,有个项目的讨论,实现RMVX窗体特效:http://rpg.blue/thread-155595-1-1.html

提交BUG:

move_to有一处拼写错误,应该是dest_y而不是dest_x。

提交更新:
  1. #==============================================================================
  2. # ■ [VX] 窗口滑动
  3. #    [VX] WindowSlide
  4. #----------------------------------------------------------------------------
  5. #    使用说明:
  6. #    创建窗口之后,可以使用调整窗口的座标,并且将窗口滑动到指定位置。
  7. #    可用于制作华丽菜单显示效果
  8. #    * 窗口.in(方向[, 移动距离])
  9. #       方向可以为 2(下), 4(左), 6(右), 8(上)
  10. #       移动距离默认为 10
  11. #       将窗口滑动至画面外。
  12. #
  13. #    * 窗口.out(方向[, 移动距离])
  14. #       方向可以为 2(下), 4(左), 6(右), 8(上)
  15. #       移动距离默认为 10
  16. #       将窗口由画面外滑动至原位。
  17. #
  18. #    * 窗口.move_to(目标 X 座标, 目标 Y 座标[, 移动距离])
  19. #       移动距离默认为 10
  20. #       将窗口滑动至指定座标。
  21. #
  22. #----------------------------------------------------------------------------
  23. #    更新作者: 雪流星(Snstar2006) DeathKing
  24. #    许可协议: FSL
  25. #    项目版本: 1.1.0131
  26. #    引用网址:
  27. #----------------------------------------------------------------------------
  28. #    - 1.2.0131 By DeathKing
  29. #      * 修正了move_to方法中的一个拼写错误导致的死循环;
  30. #
  31. #    - 1.1.0121 By 雪流星(Snstar2006)
  32. #      * 修改算法,省去计算根号的步骤,稍微提高效率;
  33. #
  34. #    - 1.0.0121 By 雪流星(Snstar2006)
  35. #      * 初版;
  36. #==============================================================================
  37. $fscript = {} if $fscript == nil
  38. $fscript["WindowSlide"] = "1.2.0131"

  39. #==============================================================================
  40. # ■ Window_Base
  41. #------------------------------------------------------------------------------
  42. #  游戏中全部窗口的超级类。
  43. #==============================================================================

  44. class Window_Base < Window
  45.   alias move_window_initialize initialize
  46.   def initialize(x, y, width, height)
  47.     move_window_initialize(x, y, width, height)
  48.     @permanent_x = x
  49.     @permanent_y = y
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 窗体划出
  53.   #     direction :  方向
  54.   #     step      : 移动的步长
  55.   #--------------------------------------------------------------------------
  56.   def in(direction, step=10)
  57.     case direction
  58.     when 2
  59.       move_to(self.x, -self.height, step)
  60.     when 4
  61.       move_to(-self.width, self.y, step)
  62.     when 6
  63.       move_to(Graphics.width + self.width, self.y, step)
  64.     when 8
  65.       move_to(self.x, Graphics.height + self.height, step)
  66.     end
  67.     Graphics.wait(1)
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 窗体划回
  71.   #     direction :  方向
  72.   #     step      : 移动的步长
  73.   #--------------------------------------------------------------------------
  74.   def out(direction, step=10)
  75.     case direction
  76.     when 2, 8
  77.       move_to(self.x, @permanent_y, step)
  78.     when 4, 6
  79.       move_to(@permanent_x, self.y, step)
  80.     end
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 移动窗体
  84.   #     dest_x    :  目的地x坐标
  85.   #     dest_y    :  目的地y坐标
  86.   #     move_step : 移动的步长
  87.   #--------------------------------------------------------------------------
  88.   def move_to(dest_x, dest_y, move_step=10)
  89.     dx = dest_x - self.x
  90.     dy = dest_y - self.y
  91.     if dx == 0
  92.       dy_step = move_step
  93.       dx_step = 0
  94.     elsif dy == 0
  95.       dx_step = move_step
  96.       dy_step = 0
  97.     else
  98.       max_distance_sq = dx**2+dy**2
  99.       angle = Math.atan(dy.abs/dx.abs)
  100.       dy_step = move_step*Math.sin(angle)
  101.       dx_step = max_distance_sq - dy_step**2
  102.     end
  103.     while (self.x != dest_x || self.y != dest_y)
  104.       if dx > 0
  105.         self.x = [self.x + dx_step, dest_x].min
  106.       else
  107.         self.x = [self.x - dx_step, dest_x].max
  108.       end
  109.       if dy > 0
  110.         self.y = [self.y + dy_step, dest_y].min
  111.       else
  112.         self.y = [self.y - dy_step, dest_y].max
  113.       end
  114.       Graphics.wait(1)
  115.     end
  116.   end
  117. end
复制代码

See FScript Here:https://github.com/DeathKing/fscript
潜心编写URG3中。
所有对URG3的疑问和勘误或者建议,请移步至发布页面。
欢迎萌妹纸催更
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
46
在线时间
10 小时
注册时间
2007-5-27
帖子
2558

第1届Title华丽大赛新人奖

4
发表于 2011-2-12 21:36:01 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
242 小时
注册时间
2011-12-10
帖子
238
5
发表于 2012-7-9 10:39:11 | 只看该作者
阿勒?这个脚本怎么用呐...看起来怪怪的说..
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
145
在线时间
38 小时
注册时间
2011-5-5
帖子
10
6
发表于 2013-12-1 17:40:48 | 只看该作者
DeathKing 发表于 2011-1-31 00:45
这个才是实用的东西啊,支持一个。
另外,有个项目的讨论,实现RMVX窗体特效:http://rpg.blue/thread ...

这个脚本咋用。。是直接修改window_base还是在main前面。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-4 07:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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