查看: 5506|回复: 3

[已经解决] (已经解决)怎么做让窗口移动的效果?

[复制链接]
梦石
0
星屑
667
在线时间
90 小时
注册时间
2019-4-14
回帖
5
发表于 2021-3-23 17:55:45 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 muffethb 于 2021-11-20 16:54 编辑

如题,,,
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2021-3-23 18:08:48 | 显示全部楼层
本帖最后由 alexncf125 于 2021-3-23 18:29 编辑

https://viparcher.github.io/Hexo ... %E7%BE%8E%E5%8C%96/
[pre lang="ruby"]#==============================================================================
# ■ VA菜单滑动
#  创意:百页书香,铅笔描绘的思念
# By :VIPArcher [email: VIPArcher@sina.com]
#  -- 本脚本来自 http://rm.66rpg.com 使用或转载请保留以上信息。
#==============================================================================
# 这里只有默认的主菜单和物品栏,其他窗口也是同样的方法。
# 具体请自己设置。一点难度都没有,依葫芦画瓢就可以了。
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:menu_slide] = 20141215
#==============================================================================
# ■ 下面Scene_Base部分最好不要动,新场景写在最下方
#==============================================================================
class Scene_Base
  #--------------------------------------------------------------------------
  # ● 开始后处理
  #--------------------------------------------------------------------------
  alias vip_slide_post_start post_start
  def post_start
    init_slide
    vip_slide_post_start
    slide_start
  end
  #--------------------------------------------------------------------------
  # ● 滑动前的准备
  #--------------------------------------------------------------------------
  def init_slide ; end
  #--------------------------------------------------------------------------
  # ● 窗口滑动处理
  #--------------------------------------------------------------------------
  def slide_start ; end
end
#-------------------------------------------------------------------------------
# ■ 上面部分最好不要改
#==============================================================================
#  菜单画面
#==============================================================================
class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 滑动前的准备
  # 重定义开始时各个窗口的位置(基本会设置到屏幕外),
  # 具体有哪些窗口去各个场景里面自己找。
  #--------------------------------------------------------------------------
  def init_slide
    @command_window.y -= 150
    @gold_window.x -= 100
    @status_window.x = 260
  end
  #--------------------------------------------------------------------------
  # ● 窗口滑动处理
  #--------------------------------------------------------------------------
  def slide_start
    10.times do
      @command_window.y += 15
      @gold_window.x    += 10
      @status_window.x  -= 10
                      # 每帧移动的坐标量
      Graphics.update # 刷新窗口
    end
    10.times{|i|
    @gold_window.x    += 5 * Math.cos(i)
    @command_window.y += 5 * Math.cos(i)
    Graphics.update}  # 弹动
  end
end
#==============================================================================
#  物品画面
#==============================================================================
class Scene_Item < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● 滑动前的准备
  #--------------------------------------------------------------------------
  def init_slide
    @category_window.x -= 100
    @item_window.y += 100
    @help_window.y -= 60
  end
  #--------------------------------------------------------------------------
  # ● 窗口滑动处理
  #--------------------------------------------------------------------------
  def slide_start
    10.times do
      @category_window.x += 10
      @item_window.y -= 10
      @help_window.y += 6
      # 每帧移动的坐标量
      Graphics.update # 刷新窗口
    end
  end
end
#==============================================================================
#  其他画面 泥萌自己写啦
#==============================================================================[/pre]
(https://rpg.blue/thread-375196-1-1.html
回复

使用道具 举报

梦石
0
星屑
667
在线时间
90 小时
注册时间
2019-4-14
回帖
5
 楼主| 发表于 2021-3-23 18:12:09 | 显示全部楼层
alexncf125 发表于 2021-3-23 18:08
https://viparcher.github.io/Hexo/2012/12/23/%E7%AA%97%E5%8F%A3%E6%BB%91%E5%8A%A8%E7%BE%8E%E5%8C%96/
...

啊这,我是指游戏窗口滑动(
不过还是感谢分享
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2021-3-24 01:04:00 | 显示全部楼层

老实说,学会这个并不会让你的游戏怎么样……
还是多花点心思做好游戏本体吧。

[pre lang="ruby"]

# 使用方法:
# set_window(x, y)
# 设置窗口位置到(x, y),从屏幕左上角开始计算

if !defined?(user32)
  def user32(function, arg_types, return_value_type)
    Win32API.new("user32.dll", function, arg_types, return_value_type)
  end
end

GetForegroundWindow = user32("GetForegroundWindow", "", "L")
SetWindowPos = user32("SetWindowPos", ["L"] * 7, 'i')

$hwnd = GetForegroundWindow.call

def set_window(x, y)
  SetWindowPos.call($hwnd, 0, x, y, Graphics.width, Graphics.height, 0)
end

[/pre]

55.gif

评分

参与人数 1赞 +1 收起 理由
alexncf125 + 1 塞糖

查看全部评分

用头画头像,用脚写脚本
回复 1 0

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部