赞 | 1 |
VIP | 1 |
好人卡 | 2 |
积分 | 1 |
经验 | 36245 |
最后登录 | 2020-7-2 |
在线时间 | 465 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 465 小时
- 注册时间
- 2011-4-13
- 帖子
- 174
|
- module BFS_Shadow
- attr_accessor :_shadow
- def shadow_on
- @_shadow = true
- end
- def shadow_off
- @_shadow = false
- end
- end
- class Spriteset_Map
- alias cy_ini initialize
- def initialize
- [url=home.php?mod=space&uid=134219]@Time[/url] = 0
- @canying = []
- cy_ini
- end
- alias cy_update update
- def update
- cy_update
- if @time == 2
- @time = 0
- else
- @time += 1
- end
- for i in @character_sprites
- if i.character._shadow and i.character.moving? and @time == 1
- sprite = Sprite_Canying.new(@viewport1, i.character)
- sprite.z = i.z
- @canying.push sprite
- end
- end
- @canying.each{|s|s.opacity <= 0 ? (s.visible = false ; @canying.delete(s)) : (s.opacity -= 15 ; s.update)} if @canying != []
- end
- end
- class Game_Player
- include BFS_Shadow
- end
- class Game_Event
- include BFS_Shadow
- end
- class Sprite_Canying < Sprite_Character
- def initialize(viewport, character = nil)
- @shadow_x = character.real_x
- @shadow_y = character.real_y
- @shadow_jump_peak = character.jump_peak
- @shadow_jump_count = character.jump_count
- @first_create = true
- super(viewport, character)
- end
- def update
- if @first_create
- super
- @first_create = false
- else
- self.x = get_screen_x
- self.y = get_screen_y
- end
- end
- def get_screen_x
- return (@shadow_x - $game_map.display_x + 3) / 4 + 16
- end
- def get_screen_y
- y = (@shadow_y - $game_map.display_y + 3) / 4 + 32
- if @shadow_jump_count >= @shadow_jump_peak
- n = @shadow_jump_count - @shadow_jump_peak
- else
- n = @shadow_jump_peak - @shadow_jump_count
- end
- return y - (@shadow_jump_peak * @shadow_jump_peak - n * n) / 2
- end
- end
- class Game_Character
- attr_accessor :jump_peak
- attr_accessor :jump_count
- end
复制代码 这个支持地图滚动时的残影,使用时对$game_player实例使用shadow_on方法即可(关闭用shadow_off) |
|