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
54 기타 말걸면그림천천히뜨기 4 file 백호 2009.02.21 1102
53 기타 무기& 방어구 레벨제한 스크립트 23 file 백호 2009.02.21 1880
52 기타 [KGC]HP&SP게이지 색다른것(글씨와 게이지가 안겹침) 10 file 백호 2009.02.21 2732
51 기타 레벨9999스크립트 4 백호 2009.02.21 1151
50 기타 [KGC]강화스크립트 백호 2009.02.21 1667
49 기타 ATS-Advanced Time System 1 file 백호 2009.02.21 964
48 기타 복권 스크립트 6 백호 2009.02.21 1258
47 기타 KGC꺼 몬스터도감 수정해봤어요;;; 9 file 백호 2009.02.21 2135
46 기타 killer님 요청하신 스크립트입니다. 1 나뚜루 2009.02.21 784
45 기타 대화창에 얼굴그래픽 스크립트 25 file 백호 2009.02.21 4137
44 기타 지정범위안에 들어오면 특정한 움직임을 취한다!! 1 백호 2009.02.21 919
43 기타 테트리스 ?구현 스크립트 2 file 백호 2009.02.21 1714
42 기타 랜덤 지하 감옥 작성 스크립트 1 file 백호 2009.02.21 1338
41 기타 마우스로 길찾기 스크립트 예제 file 백호 2009.02.21 1168
40 기타 Boat Script 백호 2009.02.21 729
39 기타 빛의 퍼즐 -미니게임- 1 file 백호 2009.02.21 1360
38 기타 동료들이 기차처럼 줄줄 따라온다!? 7 file 백호 2009.02.21 1990
37 기타 메세지창의 위치 변동 자동화 file 백호 2009.02.21 1138
36 기타 필요 경험치 직접 정하기 9 백호 2009.02.21 1408
35 기타 CG모드 도입 스크립트 file 백호 2009.02.21 1383
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13