幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1386|回复: 2

帮我完成一个描点脚本

[复制链接]

113

主题

866

帖子

7004

积分

⑦老手

pliskin

积分
7004
发表于 2006-2-6 00:22:27 | 显示全部楼层 |阅读模式
class Window_var < Window_Base
   def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height-32 )
    refresh
  end
  def refresh
     self.contents.clear
      self.opacity = 0
     #rect =Rect.new( 0, 0, $game_variables[1],32)
     color=crisis_color
     x0=320
     y0=240
     r=30
     self.contents.drawcircle(x0, y0, r, color, start=0, fin=360)
     #self.contents.fill_rect( rect,color)
   end
end

#圆形的绘制
def drawcircle(x0, y0, r, color, start=0, fin=360)
x0 = 300  #圆心
y0 = 240  #圆心
r = 30    #半径
fin += 360 if fin < start
for i in start...fin
  x = x0 + Integer(r * Math.cos(Math:I * i / 180))
  y = y0 + Integer(r * Math.sin(Math:I * i / 180))
  color=Color.new(255, 0, 0, 0)        #颜色的设置
  self.set_pixel(x, y, color)  #描点
end
end

一个在窗口中显示圆形的脚本,但是不知道是颜色不对,还是什么的,没有显示
最近,迷上八云紫大婶了
回复

使用道具 举报

50

主题

994

帖子

6699

积分

管理员

爱干啥干啥!

Rank: 9Rank: 9Rank: 9

积分
6699
发表于 2006-2-6 01:06:56 | 显示全部楼层
color=Color.new(255, 0, 0, 0)

你颜色最后一个参数是Alpha值,设成0代表全透明。自然什么都没有……

“放下屠刀,立地成佛” 故应先杀生,然后再成佛。

(\\_/) (-_-) ()+() this is bunny priest.
回复 支持 反对

使用道具 举报

113

主题

866

帖子

7004

积分

⑦老手

pliskin

积分
7004
 楼主| 发表于 2006-2-6 01:20:02 | 显示全部楼层
谢谢!成功得在窗口中描绘了一个圆 [s:2]
最近,迷上八云紫大婶了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2026-6-21 14:59 , Processed in 0.010611 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表