VX 스크립트

기타
2011.07.22 14:06

화면 확대 스크립트

profile
조회 수 3059 추천 수 2 댓글 12
Atachment
첨부 '1'
화면 확대 스크립트 입니다. 사용법은 다음과 같습니다.
$game_map.start_zoom(확대율, 확대속도)
$game_map.start_zoom_back(확대율, 확대속도, 돌아오는 속도)

첨부한 스크립트도 같이 사용해야 합니다.

class Game_Map
  attr_accessor :zoom
  alias zoom_initialize initialize
  alias zoom_update update
  def initialize
    zoom_initialize
    @zoom = 1.0
    @zoom_target = 1.0
    @zoom_duration = 0
    @zoom_back_duration = 0
    @original_display_x = @display_x
    @original_display_y = @display_y
  end
  def update
    zoom_update
    if @zoom_duration >0
      @zoom_duration -= 1
      @zoom += @zoom_speed
      @display_x = $game_player.real_x - 256 * 8 / @zoom
      @display_y = $game_player.real_y - 256 * 6 / @zoom
      if @display_x < 0
        @display_x = 0
      end
      if @display_y < 0
        @display_y = 0
      end
      if @display_x > @map.width * 256 - 256 * 17 / @zoom
        @display_x =  @map.width * 256 - 256 * 17 / @zoom
      end
      if @display_y > @map.height * 256 - 256 * 13 / @zoom
        @display_y =  @map.height * 256 - 256 * 13 / @zoom
      end
    else
      @zoom = @zoom_target
    end
    if @zoom_back_duration >0
      @zoom_back_duration -= 1
      if @zoom_back_duration == 0
        start_zoom(1,20)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Set Display Position
  #     x : New display X coordinate (*256)
  #     y : New display Y coordinate (*256)
  #--------------------------------------------------------------------------
  def set_display_pos(x, y)
    @display_x = (x + @map.width * 256) % (@map.width * 256)
    @display_y = (y + @map.height * 256) % (@map.height * 256)
    @parallax_x = x
    @parallax_y = y
  end
  #--------------------------------------------------------------------------
  # * Calculate X coordinate, minus display coordinate
  #     x : x-coordinate
  #--------------------------------------------------------------------------
  def adjust_x(x)
    if loop_horizontal? and x < @display_x - @margin_x
      return x - @display_x + @map.width * 256
    else
      return (x - @display_x) * @zoom
    end
  end
  #--------------------------------------------------------------------------
  # * Calculate Y coordinate, minus display coordinate
  #     y : y-coordinate
  #--------------------------------------------------------------------------
  def adjust_y(y)
    if loop_vertical? and y < @display_y - @margin_y
      return y - @display_y + @map.height * 256
    else
      return (y - @display_y) * @zoom
    end
  end
  def start_zoom(zoom,zoom_speed)
    @original_display_x = @display_x
    @original_display_y = @display_y
    @zoom_target = zoom
    if zoom > @zoom
      @zoom_speed = zoom_speed.to_f / 60
    else
      @zoom_speed = -zoom_speed.to_f / 60
    end
    @zoom_duration = (zoom - @zoom) / @zoom_speed
  end
  def start_zoom_back(zoom,zoom_speed,duration)
    @original_display_x = @display_x
    @original_display_y = @display_y
    @zoom_target = zoom
    if zoom > @zoom
      @zoom_speed = zoom_speed.to_f / 60
    else
      @zoom_speed = -zoom_speed.to_f / 60
    end
    @zoom_duration = (zoom - @zoom) / @zoom_speed
    @zoom_back_duration = duration
  end
end

class Spriteset_Map
  alias zoom_update update
  alias zoom_update_characters update_characters
  def update
   @zoom = $game_map.zoom
    zoom_update
  end
  def update_tilemap
    @tilemap.ox = ($game_map.display_x) / 8
    @tilemap.oy = ($game_map.display_y) / 8 
    @tilemap.zoom = @zoom
    @tilemap.update
  end
  
  def update_characters
    zoom_update_characters
    if @zoom != 0
      for sprite in @character_sprites
          sprite.zoom = @zoom
      end
    end
  end
end

class Sprite_Character
  attr_accessor :zoom
  alias zoom_update update
  alias zoom_initialize initialize
  def initialize(viewport, character = nil)
    @zoom = 1
    zoom_initialize(viewport, character)
  end
  def update
    zoom_update
    self.zoom_x = @zoom
    self.zoom_y = @zoom
  end
end

class Game_Character
  def screen_x
    return ($game_map.adjust_x(@real_x) + 8007) / 8 - 1000 + 16 * $game_map.zoom
  end
  def screen_y
    y = ($game_map.adjust_y(@real_y) + 8007) / 8 - 1000 + 32 * $game_map.zoom
    y -= 4 unless object?
    if @jump_count >= @jump_peak
      n = @jump_count - @jump_peak
    else
      n = @jump_peak - @jump_count
    end
    return y - (@jump_peak * @jump_peak - n * n) / 2
  end

end 









Who's 에돌이

profile
돌이 돌이 에돌이. 에돌 에돌 에돌이. 
Comment '12'
  • ?
    석진이 2011.07.23 02:33

    우와 멋있다!!!

  • ?
    베넘 2011.07.23 02:48

    오.. 멋지다. 잘쓸게요. >_<

  • ?
    신휴이 2011.07.24 12:15

    스크립트도 스크립트지만 응용 비디오가 정말 인상 깊네요.

  • ?
    오그리토그리 2011.07.24 23:42

    오옷! 잘쓰겠습니다

  • ?
    RPG가 짱이야 2011.07.26 21:10

    동영상에 렉이....

  • profile
    개촙포에버 2011.07.27 20:57

    저기..;;동영상에 나온 응용한거 말이죠.예제좀 올려주시면 안될까요?

    ㅎㅎ

  • ?
    시객 2011.07.29 14:50

    잘 쓸께요


  • ?
    웃자 2011.07.29 20:54

    예제를 꼭 올려주세요.. 어떻게 사용하는지.. 잘 모르겠네요

  • ?
    이상한드링크 2011.08.02 12:54

    던파 같다 ㅋㅋ

  • ?
    그 누군가 2011.08.17 12:02

    ㄳ요

  • ?
    늑대고양이 2013.12.15 21:34
    줌은 필요없구요 채력 마력 경험치 알려주는 스크립트랑
    저렇개 싸우는 스크립트좀 찾아주세요 ㄷㄷ
  • ?
    불곰 2014.02.03 19:40
    무슨 말을 그렇게 하시나요.. 님한테 필요없으면 글쓰면 안되나요?
    체력마력경험치 표시 스크립트 액알 스크립트 널려있는데 님은 검색 하실줄모르시나요?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
130 기타 Gamepad Extender VX 습작 2015.01.02 672
129 기타 장애물을 피하고 다가오게 하는 스크립트 5 file 박력남 2014.02.25 1877
128 기타 Resize and Scale by OriginalWij 1 습작 2013.05.13 1349
127 기타 reijubv - New Balloon Command (VXA에서도 작동) 1 file 혜인 2013.04.08 1332
126 기타 MSX - XP Characters on VX/VX Ace 2 Alkaid 2013.01.26 1345
125 기타 Fullscreen++ by Zeus81 (VX/VXA) 2 Alkaid 2012.09.01 2230
124 기타 Etude87_GAGA_Chat 4 습작 2012.06.14 1916
123 기타 Etude87_Hangul_utf8_List 습작 2012.06.04 1664
122 기타 078656577er님의 스크립트를 개조한, 사격용 스크립트 1 file 타코 2012.03.16 2519
121 기타 멥 이름 띄우기 10 신규회원 2012.02.24 3626
120 기타 화면 해상도(640 X 480) 스크립트 6 file 쿠쿠밥솥 2012.01.10 3972
119 기타 아이디를 띄우기 20 12345678 2011.11.07 4626
118 기타 Kylock1.2+(RMDude-Kylock1.5) Time System Script 4 file communnn 2011.10.20 2595
117 기타 [XP / VX 공용] rand() 함수 확장 스크립트 4 허걱 2011.09.13 2362
116 기타 여러스크립트(목적은 포인트) 12 file 인생은 힘들다. 2011.08.26 3087
115 기타 요리 시스템을 도입하는 스크립트입니다. 9 file 스페나로츠 2011.08.18 3141
» 기타 화면 확대 스크립트 12 file 에돌이 2011.07.22 3059
113 기타 해상도 변경 스크립트 11 카리스 2011.07.19 2723
112 기타 KGC counter 스크립트. 반격기 추가스크립트입니다. 4 우켈킁 2011.03.31 1812
111 기타 IEX - Script Library 1.0 by IceDragon 8 Alkaid 2011.01.11 2619
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7