查看: 1464|回复: 2

[已经解决] 新手脚本求救。。文字不显示

[复制链接]

幻想天神

梦石
0
星屑
55
在线时间
166 小时
注册时间
2012-3-24
回帖
355
发表于 2013-4-30 18:50:28 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 风若·飘絮 于 2013-5-1 21:31 编辑
  1. class Ui < Window_Base
  2.   def initialize
  3.   super(0,0,640,480)
  4.    @tu = Sprite.new
  5.    @tu.bitmap = RPG::Cache.title("人物状态.png")
  6.    @tu.x=60
  7.    @tu.y=0
  8.    @tu.z=200
  9.    @contents = Bitmap.new(608,448)
  10.    @contents.font.name = "黑体"   
  11.    @contents.font.size = 40
  12.    @contents.font.color =Color.new(255,255,255,255)
  13.    
  14.    refresh
  15. end

  16. def refresh
  17.    tu.update
  18.    @contents.draw_text(55, 42, 200, 32,"4566654646546")
  19. end

  20. end
复制代码
我在事件里创建的对象,只显示图片,不显示文字
梦石
0
星屑
50
在线时间
466 小时
注册时间
2013-2-8
回帖
420
发表于 2013-4-30 19:14:15 | 显示全部楼层
要用 self.contents
不知道为什么 self.contents 指向的不是 @contents
回复

使用道具 举报

幻想天神

梦石
0
星屑
55
在线时间
166 小时
注册时间
2012-3-24
回帖
355
 楼主| 发表于 2013-4-30 20:06:45 | 显示全部楼层
SuperMario 发表于 2013-4-30 19:14
要用 self.contents
不知道为什么 self.contents 指向的不是 @contents

用self还是无效,我觉得和这个应该没什么关系吧,因为其他语言里self.是私有变量关键字(RUBY用法不知)
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部