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
637 ((대박!)) 게임상의 모든 글자에 효과 주기.. 33 미카엘 2008.08.20 5582
636 (?스크립트) 스크립트 읽어서 그래픽 넣으세요.(영어 잘하는 사람만 권장...) 2 Man... 2008.10.27 1444
635 메뉴 (모그메뉴 풀세트팩 SEL Style.) 유니크급 자료 147 file 할렘 2009.02.07 9558
634 상점 (수정)크리쳐 샵, 'SW_CreatureShop' by Siot Warrior 15 file 시옷전사 2010.09.03 3675
633 액터 (수정)크리쳐 합체, 'SW_CreatureMix' by SiotWarrior 22 file 시옷전사 2010.09.07 2972
632 기타 (이거 정말 좋군요) 말이나 용을 탈수있게 하는 스크립트. 31 file 아방스가 짱 2010.02.28 4261
631 기타 (좀 이상한 or 쓸모없을 듯 한)화면상에 몬스터와 만나려면 몇걸음 남았는지 표시하는 스크립트! 2 루시페르 2009.06.06 2318
630 기타 078656577er님의 스크립트를 개조한, 사격용 스크립트 1 file 타코 2012.03.16 2519
629 기타 2 Players Engine 11 레이니케 2008.03.28 2294
628 2 Players Engine 2인용하기 15 file RPGbooster 2008.10.08 3999
627 전투 2003식 사이드뷰 적들도 가까이와서 공격함 ㅇㅇ 51 배군 2008.05.02 6750
626 이동 및 탈것 2D 횡스크롤 스크립트 56 file 사람이라면? 2010.08.15 7570
625 이동 및 탈것 3D 던젼 스크립트 38 아방스 2010.12.06 5772
624 그래픽 3D그래픽 파티클엔진 45 file RPGbooster 2008.10.08 10130
623 파티 5인 파티 프로젝트 V1.1 4 file 지나가는떡꼬치 2012.06.30 2988
622 이동 및 탈것 8 방향 이동스크립트 + 스프라이트 효과 12 file 레오 2009.02.06 7557
621 기타 <중수이상>RPG VX의 대표적 참조값 6 까까까 2009.05.31 3236
620 영상 ??(Avi play ver beta 0.8) 4 Man... 2008.10.28 1575
619 ??(다 영어)여기서 부터 드레그만 빼고 Man... 2008.10.27 1078
618 ??? 1 Man... 2008.10.27 1020
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32