| 赞 | 2  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 4 | 
 
| 经验 | 0 | 
 
| 最后登录 | 2021-3-16 | 
 
| 在线时间 | 34 小时 | 
 
 
 
 
 
Lv2.观梦者 
	- 梦石
 - 0 
 
        - 星屑
 - 430 
 
        - 在线时间
 - 34 小时
 
        - 注册时间
 - 2018-4-9
 
        - 帖子
 - 17
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
按照文档改写计时器时遇到了这个问题。 
 
class Sprite_Timer 
  alias jingmo_create_bitmap create_bitmap 
  alias jingmo_update_position update_position 
  def create_bitmap 
    jingmo_create_bitmap 
    self.bitmap = Bitmap.new(200,50) 
    self.bitmap.font.size=20 
    self.bitmap.font.color.set(50,62,78) 
  end 
  def update_position  
    x=0 
  end 
end 
不加self.的话那bitmap就还是未改写之前的bitmap。 
而update_position中x虽然没有加self.却没问题。 
下面是原来的方法。 
 
 def create_bitmap 
    self.bitmap = Bitmap.new(96, 48) 
    self.bitmap.font.size = 32 
    self.bitmap.font.color.set(255, 255, 255) 
  end 
 
 
 def update_position 
    self.x = Graphics.width - self.bitmap.width 
    self.y = 0 
    self.z = 200 
  end |   
 
 
 
 |