Project1

标题: 圆形半成品求调教(死 [打印本页]

作者: ~❤    时间: 2011-7-8 18:49
标题: 圆形半成品求调教(死
于是写了一个奇怪的圆形(死
但是实际效果真心吐槽不能(死
诸君求调教>_<~(死
  1. class Sprite_round < Sprite
  2.   def initialize(rid, rx, ry, rwidth, rheight, zoomplus=0.0, zoom=true)
  3.     super()
  4.     @rid = rid
  5.     @rx = rx
  6.     @ry = ry
  7.     @rwidth = rwidth
  8.     @rheight = rheight
  9.     @zoomplus = zoomplus
  10.     @zoom = zoom
  11.     round_update
  12.   end
  13.   def round_update
  14.     case @rid
  15.     when 0..90
  16.       if @rid == 0
  17.         self.ox = @rx
  18.         self.oy = @ry + @rheight
  19.       else
  20.         self.ox = @rx + Math.sin(Math::PI / (180.0 / @rid)) * @rwidth
  21.         self.oy = @ry + Math.cos(Math::PI / (180.0 / @rid)) * @rheight
  22.       end
  23.     when 91..180
  24.         self.ox = @rx + Math.cos(Math::PI / (180.0 / (@rid-90))) * @rwidth
  25.         self.oy = @ry - Math.sin(Math::PI / (180.0 / (@rid-90))) * @rheight
  26.     when 181..270
  27.         self.ox = @rx - Math.sin(Math::PI / (180.0 / (@rid-180))) * @rwidth
  28.         self.oy = @ry - Math.cos(Math::PI / (180.0 / (@rid-180))) * @rheight
  29.     when 271..360
  30.         self.ox = @rx - Math.cos(Math::PI / (180.0 / (@rid-270))) * @rwidth
  31.         self.oy = @ry + Math.sin(Math::PI / (180.0 / (@rid-270))) * @rheight
  32.     end
  33.     self.x = self.ox * 2
  34.     self.y = self.oy * 2
  35.     self.z = self.oy
  36.     self.zoom_x = self.zoom_y = self.oy / 480.0 + @zoomplus if @zoom
  37.   end
  38. end
复制代码

作者: 忧雪の伤    时间: 2011-7-8 18:50
Sprite_round这习惯不好……




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