Project1

标题: 新手脚本求救。。文字不显示 [打印本页]

作者: 风若·飘絮    时间: 2013-4-30 18:50
标题: 新手脚本求救。。文字不显示
本帖最后由 风若·飘絮 于 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
复制代码
我在事件里创建的对象,只显示图片,不显示文字
作者: SuperMario    时间: 2013-4-30 19:14
要用 self.contents
不知道为什么 self.contents 指向的不是 @contents
作者: 风若·飘絮    时间: 2013-4-30 20:06
SuperMario 发表于 2013-4-30 19:14
要用 self.contents
不知道为什么 self.contents 指向的不是 @contents

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




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1