Project1
标题:
请问怎么在脚本中调用方法?
[打印本页]
作者:
wbsy8241
时间:
2009-6-9 01:39
标题:
请问怎么在脚本中调用方法?
我初学脚本 写了3个方便点的显示图片
#-------------------------------------
# ● 自定义显示图片
#-------------------------------------
def pi(name, x, y)
@name = name
@x = x.to_f
@y = y.to_f
end
#-------------------------------------
# ● 自定义移动图片
#-------------------------------------
def mv(y)
@duration = 2
@target_x = x
@target_y = y.to_f
@target_opacity = 255
end
#-------------------------------------
# ● 自定义消失图片
#-------------------------------------
def me
@duration = 4
@target_opacity = 0
end
复制代码
在事件脚本中这样写:
$game_screen.pictures[41].pi($y)
$y -= 10
$game_screen.pictures[41].mv($y)
@wait_count = 2
$y += 12
$game_screen.pictures[41].mv($y)
@wait_count = 20
$game_screen.pictures[41].me
效果是让1幅图片 往上跳出来 在往下降 等一会消失
因为会执行多张这种图,用了等待以后 $y 会被改变
如何才能整和到1个方法中?
def ph
$game_screen.pictures[41].pi(y)
$game_screen.pictures[41].mv(y)
y -= 10
@wait_count = 2
$game_screen.pictures[41].mv(y)
@wait_count = 20
y += 12
$game_screen.pictures[41].me(y)
end
或者可不可以定义方法的时候直接定义出这种效果?
[LINE]1,#dddddd[/LINE]
自己解决了.
if @new >= 1
if @new >= 27
@y -= 3
elsif @new >= 24
@y += 3
elsif @new <= 3
@opacity -= 96
end
@new -= 1
end
复制代码
作者:
goahead
时间:
2009-6-9 01:43
提示:
作者被禁止或删除 内容自动屏蔽
作者:
wbsy8241
时间:
2009-6-9 01:47
以下引用
goahead于2009-6-8 17:43:48
的发言:
写个专业用来显示数字动画的sprite
参考F1里的 RPG::Sprite
还不太会 改显示图片的比较简单- -
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1