VX 스크립트

기타
2011.07.22 14:06

화면 확대 스크립트

profile
조회 수 3061 추천 수 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
377 아이템 드롭 아이템 확장 6 신규회원 2012.02.24 2977
376 기타 KGC 리버스 데미지! 28 루시페르 2009.04.13 2979
375 아이템 아이템 무게, 아이템별 소지수 적용 16 file 허걱 2010.11.11 2981
374 파티 5인 파티 프로젝트 V1.1 4 file 지나가는떡꼬치 2012.06.30 2988
373 액터 동료가 따라다니게 하는 스크립트 (Woratana's Caterpillar System) 5 MinaAubert 2012.09.13 3012
372 기타 땅파기 18 file 비극ㆍ 2010.04.19 3013
371 상태/속성 YERD - Custom Status Properties 7 훈덕 2009.11.08 3021
370 기타 메뉴에서 애니매이션 사용! 12 비극ㆍ 2010.04.19 3022
369 기타 카지노 슬롯머신 15 file 아방스가 짱 2010.02.28 3023
368 맵/타일 맵상 캐릭터 그래픽 확대 / 축소 이벤트 스크립트 6 시트르산 2010.09.10 3023
367 장비 아이템 장비시 스킬습득, 'SW_EquipFinisher' by Siot Warrior 19 file 시옷전사 2010.08.31 3029
366 스킬 체스트 팝업 3.0 9 file 파이어 2010.12.05 3037
365 메뉴 윈도우창 크기 조절 스크립트 0.3 5 아방스 2008.01.30 3038
364 이동 및 탈것 Wachunga님의 XP용 MapLink VX용으로 개조 6 file 허걱 2009.02.13 3039
363 장비 장비에 레벨제한 스크립트!! 21 ijsh515 2010.09.19 3040
» 기타 화면 확대 스크립트 12 file 에돌이 2011.07.22 3061
361 기타 Base Project 15 아방스 2009.02.05 3063
360 타이틀/게임오버 메인 화면을 건너뛰고 시작하는 스크립트 14 아방스 2008.02.01 3064
359 전투 Actor Battler Graphics 13 아방스 2008.03.07 3065
358 장비 남성 / 여성전용 장비 스크립트 (수정 v1.1) 16 Evangelista 2009.11.15 3070
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 32 Next
/ 32