XP 스크립트

#==============================================================================
# ■ Sprite_Mirror
# Based on Sprite_Shadow, modified by Rataime
#==============================================================================

class Sprite_Mirror < RPG::Sprite

attr_accessor :character
attr_accessor :events
attr_accessor :event_y

def initialize(viewport=nil)
  super(viewport)
  @character = $game_player
  @events=0
  @event_y=0
  self.opacity=0
  update
end

def update
  super
  if @tile_id != @character.tile_id or
     @character_name != @character.character_name or
     @character_hue != @character.character_hue
    @tile_id = @character.tile_id
    @character_name = @character.character_name
    @character_hue = @character.character_hue
    if @tile_id >= 384
      self.bitmap = RPG::Cache.tile($game_map.tileset_name,
        @tile_id, @character.character_hue)
      self.src_rect.set(0, 0, 32, 32)
      self.ox = 16
      self.oy = 32
    else
      self.bitmap = RPG::Cache.character(@character.character_name,
        @character.character_hue)
      @cw = bitmap.width / 4
      @ch = bitmap.height / 4
      self.ox = @cw / 2
      self.oy = @ch
    end
  end
  self.visible = (not @character.transparent)
  if @tile_id == 0
    sx = (@character.pattern) * @cw
    sy = (@character.direction - 2) / 2 * @ch
    if @character.direction==8
      sy = 0 * @ch
    end
    if @character.direction==2
      sy = 3 * @ch
    end
    self.src_rect.set(sx, sy, @cw, @ch)
  end
  self.x = @character.screen_x
  self.y = self.event_y-($game_player.screen_y-self.event_y).abs+30
  self.z = 10
  self.blend_type = @character.blend_type
  self.bush_depth = @character.bush_depth
  if @character.animation_id != 0
    animation = $data_animations[@character.animation_id]
    animation(animation, true)
    @character.animation_id = 0
  end
end
end

#===================================================
# ▼ CLASS Sprite_Character edit
#===================================================

class Sprite_Character < RPG::Sprite
 alias mirror_initialize initialize
 
 def initialize(viewport, character = nil)
   @character = character
   super(viewport)
   if character.is_a?(Game_Player)
    $game_map.mirror=Sprite_Mirror.new(viewport)
   end
   mirror_initialize(viewport, @character)
 end
 
 alias mirror_update update
 
 def update
  mirror_update
  if (@mirror!=nil and character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["m"])
    if $game_player.screen_y-self.y<80 and self.y<$game_player.screen_y and ($game_player.screen_x-self.x).abs<17
      if (character.list[1]!=nil and character.list[1].code == 108)
        @mirror.opacity=character.list[1].parameters[0].to_f
      else
        @mirror.opacity=$game_player.opacity
      end
      @mirror.events=self.id
      @mirror.event_y=self.y
    else
      if @mirror.events==self.id
        @mirror.events=0
      else
        if @mirror.events==0
          @mirror.opacity=0
        end
      end
    end
  end
  @mirror=$game_map.mirror
  if character.is_a?(Game_Player)
    @mirror.update
  end
 end
 
end

#===================================================
# ▼ CLASS Scene_Save edit
#===================================================
class Scene_Save < Scene_File
 
 alias mirror_write_save_data write_save_data
 
 def write_save_data(file)
   $game_map.mirror = nil
   mirror_write_save_data(file)
 end
end

#===================================================
# ▼ CLASS Game_Map edit
#===================================================
class Game_Map
 attr_accessor :mirror
end

#===================================================
# ▼ CLASS Scene_Map edit
#===================================================
class Spriteset_Map
 
 alias mirror_map_initialize initialize
 
 def initialize
   $game_map.mirror=nil
   mirror_map_initialize
 end
end

 

Comment '20'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
214 기타 쓸 용도가 없지만 마비노기 게임 만들 때 좋죠[장작스크립트] 5 백호 2009.02.22 2408
213 기타 레벨을 표시해주는 스크립트 5 백호 2009.02.22 2403
» 기타 거울에 캐릭 반사 20 ok하승헌 2010.02.18 2388
211 기타 스탯 13 file 이안 2010.01.17 2320
210 기타 rpgxp [체험판] 입니다. 6 file 인웅이 아부지 2010.01.12 2289
209 기타 명령어들 6 지존!! 2010.07.24 2288
208 기타 탤레포트 스크립트 3 앞잡이 2011.12.10 2260
207 기타 [신기술 체험] 마우스 클릭 드래그 드롭 7 file 백호 2009.02.22 2246
206 기타 한계 돌파스크립트 8 G MAX 2009.09.03 2206
205 기타 [회복] 대기 회복 스크립트4.0 여러 오류 문제 해결 및 길이 줄임 11 file 코아 코스튬 2010.11.06 2189
204 기타 클리어 횟수 기록하기 1 file 허걱 2009.08.22 2188
203 기타 [신기술 체험] 솔로채팅창 17 file 백호 2009.02.22 2187
202 기타 대화창 글자 한글자씩뜨는 스크립트 7 백호 2009.02.22 2185
201 기타 [신기술 체험] 레이싱 스크립트 8 file 백호 2009.02.22 2185
200 기타 [All RGSS] 윈도우 메세지박스 스크립트 (Completed ver) 5 file Cheapmunk 2014.06.22 2179
199 기타 데이터베이스 자체 제한 해체 XP Ver. 13 THE풀잎 2010.07.04 2171
198 기타 [맵 아이디 확인 스크립트] 맵아이디 모르는 사람을 위한 스크립트 9 file 코아 코스튬 2010.10.09 2161
197 기타 홈페이지 띄우기 (VX 상관없음.) 6 KNAVE 2009.08.25 2137
196 기타 KGC꺼 몬스터도감 수정해봤어요;;; 9 file 백호 2009.02.21 2135
195 기타 Upload & Download files with RGSS 2.1 by berka (XP/VX 공용) 5 Alkaid 2010.11.20 2134
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13