赞 | 5 |
VIP | 0 |
好人卡 | 2 |
积分 | 36 |
经验 | 24079 |
最后登录 | 2024-11-5 |
在线时间 | 1890 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3596
- 在线时间
- 1890 小时
- 注册时间
- 2010-6-19
- 帖子
- 1211
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 黑米馒头 于 2022-10-28 11:30 编辑
下面这个脚本可以显示信息文本,
功能为,在窗口显示文本,最高可以显示18行,但是当屏幕显示满18行之后,就无法继续显示后面的文本内容了(内容超过了窗口高度),
只能用代码$message_sprite.bitmap.clear把文本内容清空,然后修改索引位置,以达到显示后面的文本内容,要如何修改
索引$message_index=19的时候,前面的文本内容往上移动的效果
viewport = Viewport.new(0,0,640,480) viewport.z = 200 $message_sprite = Sprite.new(viewport) $message_sprite.bitmap = Bitmap.new(640,480) $message_sprite.x = 6 $message_sprite.y = 5 $message_sprite.z = 99999 $message_sprite.visible = true $message_sprite.bitmap.font.size = 15 $message_sprite.bitmap.font.color.set(255,255,255,255) class Window_Goods < Window_Base def initialize super(0, 0, 42, 42) self.opacity = 120 self.visible = true $game_party.update_message("养成存档习惯,避免从头再来!","_系统") end end def update_message(txt,a="_系统") bitmap = RPG::Cache.picture(a) rect = Rect.new(0,0,bitmap.width,bitmap.height) if $message_index < 19 $message_sprite.bitmap.blt(1,4 + $message_index * 25, bitmap,rect) $message_sprite.bitmap.draw_text(5+bitmap.width, 4 + $message_index * 25, 300,bitmap.height, txt) $message_index += 1 else $message_sprite.bitmap.clear $message_sprite.bitmap.blt(1,4,bitmap,rect) $message_sprite.bitmap.draw_text(5+bitmap.width, 4, 300,bitmap.height, txt) $message_index = 1 end end
viewport = Viewport.new(0,0,640,480)
viewport.z = 200
$message_sprite = Sprite.new(viewport)
$message_sprite.bitmap = Bitmap.new(640,480)
$message_sprite.x = 6
$message_sprite.y = 5
$message_sprite.z = 99999
$message_sprite.visible = true
$message_sprite.bitmap.font.size = 15
$message_sprite.bitmap.font.color.set(255,255,255,255)
class Window_Goods < Window_Base
def initialize
super(0, 0, 42, 42)
self.opacity = 120
self.visible = true
$game_party.update_message("养成存档习惯,避免从头再来!","_系统")
end
end
def update_message(txt,a="_系统")
bitmap = RPG::Cache.picture(a)
rect = Rect.new(0,0,bitmap.width,bitmap.height)
if $message_index < 19
$message_sprite.bitmap.blt(1,4 + $message_index * 25, bitmap,rect)
$message_sprite.bitmap.draw_text(5+bitmap.width, 4 + $message_index * 25, 300,bitmap.height, txt)
$message_index += 1
else
$message_sprite.bitmap.clear
$message_sprite.bitmap.blt(1,4,bitmap,rect)
$message_sprite.bitmap.draw_text(5+bitmap.width, 4, 300,bitmap.height, txt)
$message_index = 1
end
end
|
|