赞 | 274 |
VIP | 0 |
好人卡 | 3 |
积分 | 496 |
经验 | 40966 |
最后登录 | 2024-9-22 |
在线时间 | 1920 小时 |
Lv5.捕梦者
- 梦石
- 10
- 星屑
- 39587
- 在线时间
- 1920 小时
- 注册时间
- 2010-11-14
- 帖子
- 3320
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 KB.Driver 于 2020-4-20 11:25 编辑
使用方向键可以造成对话窗口会动的感觉。
需要先插入上面这段脚本
点我
脚本本体:
#encoding:utf-8 ## # Ugoku # author: Calendar99 # # use arrow keys to make your message window ugokemasu. ## class Window_Message dur = 15 power = 90 tw = ->(ab, inout) { "Tween.new(#{ab}, Tween::Cubic::#{inout}, #{dur})" } expo_tws = "->(a, b) { [(#{tw['a, b','Out']}), (#{tw['b, a' ,'In']})] }" { :down => [:oy, "->(ox, oy) { (#{expo_tws})[oy, oy - #{power}] }"], :up => [:oy, "->(ox, oy) { (#{expo_tws})[oy, oy + #{power}] }"], :right => [:ox, "->(ox, oy) { (#{expo_tws})[ox, ox - #{power}] }"], :left => [:ox, "->(ox, oy) { (#{expo_tws})[ox, ox + #{power}] }"], }.each {|meth, (attr, tws)| class_eval %{ def ugoku_#{meth} if @#{attr}_tweens.empty? @#{attr}_tweens += (#{tws}).call(ox, oy) else @#{attr}_tweens.shift until @#{attr}_tweens.size == 1 @#{attr}_tweens.unshift (#{tws}).call(ox, oy)[0] @#{attr}_tweens[1].start[0] = @#{attr}_tweens[0].finish[0] @#{attr}_tweens[1].rewind end end } } alias initialize_ugoku_calendar99 initialize def initialize initialize_ugoku_calendar99 @ox_tweens = [] @oy_tweens = [] end alias update_ugoku_calendar99 update def update process_ugoku update_ugoku update_ugoku_calendar99 end def process_ugoku return unless active && open? ugoku_down if Input.trigger?(:DOWN) ugoku_up if Input.trigger?(:UP) ugoku_right if Input.trigger?(:RIGHT) ugoku_left if Input.trigger?(:LEFT) end upd = ->(param) { %{ unless @#{param}_tweens.empty? if @#{param}_tweens[0].done @#{param}_tweens.shift end if tw = @#{param}_tweens[0] tw.update self.#{param} = tw.value end end } } class_eval %{ def update_ugoku #{upd['ox']} #{upd['oy']} end } end
#encoding:utf-8
##
# Ugoku
# author: Calendar99
#
# use arrow keys to make your message window ugokemasu.
##
class Window_Message
dur = 15
power = 90
tw = ->(ab, inout) { "Tween.new(#{ab}, Tween::Cubic::#{inout}, #{dur})" }
expo_tws = "->(a, b) { [(#{tw['a, b','Out']}), (#{tw['b, a' ,'In']})] }"
{
:down => [:oy, "->(ox, oy) { (#{expo_tws})[oy, oy - #{power}] }"],
:up => [:oy, "->(ox, oy) { (#{expo_tws})[oy, oy + #{power}] }"],
:right => [:ox, "->(ox, oy) { (#{expo_tws})[ox, ox - #{power}] }"],
:left => [:ox, "->(ox, oy) { (#{expo_tws})[ox, ox + #{power}] }"],
}.each {|meth, (attr, tws)|
class_eval %{
def ugoku_#{meth}
if @#{attr}_tweens.empty?
@#{attr}_tweens += (#{tws}).call(ox, oy)
else
@#{attr}_tweens.shift until @#{attr}_tweens.size == 1
@#{attr}_tweens.unshift (#{tws}).call(ox, oy)[0]
@#{attr}_tweens[1].start[0] = @#{attr}_tweens[0].finish[0]
@#{attr}_tweens[1].rewind
end
end
}
}
alias initialize_ugoku_calendar99 initialize
def initialize
initialize_ugoku_calendar99
@ox_tweens = []
@oy_tweens = []
end
alias update_ugoku_calendar99 update
def update
process_ugoku
update_ugoku
update_ugoku_calendar99
end
def process_ugoku
return unless active && open?
ugoku_down if Input.trigger?(:DOWN)
ugoku_up if Input.trigger?(:UP)
ugoku_right if Input.trigger?(:RIGHT)
ugoku_left if Input.trigger?(:LEFT)
end
upd = ->(param) {
%{
unless @#{param}_tweens.empty?
if @#{param}_tweens[0].done
@#{param}_tweens.shift
end
if tw = @#{param}_tweens[0]
tw.update
self.#{param} = tw.value
end
end
}
}
class_eval %{
def update_ugoku
#{upd['ox']}
#{upd['oy']}
end
}
end
|
评分
-
查看全部评分
|