赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 8 |
经验 | 132 |
最后登录 | 2014-9-6 |
在线时间 | 1270 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 777
- 在线时间
- 1270 小时
- 注册时间
- 2011-2-14
- 帖子
- 5589
|
特别帮你写了一段,里面用的是正弦函数来控制震动。因此需要四个参数
调用方法 $game_map.screen.pictures[图片编号].shake("x"和"y"中任选一个,振动幅度,振动速度,振动时间) #震动幅度数值建议在2~20之间,振动速度建议设定在10~120之间- class Game_Picture
- alias sakuya_init initialize
- def initialize(number)
- sakuya_init(number)
- @shake_d = "x"
- @shake_T = 0
- @shake_t = 0
- @shake_r = 0
- @shake_tx = 0
- end
- def shake(a,b=1,c=1,d=20)
- @shake_d = a
- @shake_r = c
- @shake_T = b
- @shake_t = 0
- @shake_tx = d
- end
- def get_exxy
- return [0,0] if @shake_tx == 0
- @shake_t += 1
- if @shake_t == @shake_tx
- @shake_t = @shake_tx = 0
- end
- l = 180 / 3.14
- del = @shake_r * Math.sin(@shake_t*@shake_T/l)
- case @shake_d
- when "x"
- return [del,0]
- when "y"
- return [0,del]
- end
- end
- end
- class Sprite_Picture < Sprite
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- if @picture_name != @picture.name
- @picture_name = @picture.name
- if @picture_name != ""
- self.bitmap = Cache.picture(@picture_name)
- end
- end
- if @picture_name == ""
- self.visible = false
- else
- self.visible = true
- if @picture.origin == 0
- self.ox = 0
- self.oy = 0
- else
- self.ox = self.bitmap.width / 2
- self.oy = self.bitmap.height / 2
- end
- del = @picture.get_exxy
- self.x = @picture.x + del[0]
- self.y = @picture.y + del[1]
- self.z = 100 + @picture.number
- self.zoom_x = @picture.zoom_x / 100.0
- self.zoom_y = @picture.zoom_y / 100.0
- self.opacity = @picture.opacity
- self.blend_type = @picture.blend_type
- self.angle = @picture.angle
- self.tone = @picture.tone
- end
- end
- end
复制代码 下面是范例,里面的断头骷髅禁止搬运
Project13.7z
(400.11 KB, 下载次数: 77)
@火焰卷轴 |
评分
-
查看全部评分
|