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
637 전투 VLAD ABS [액알 시스템] 65 아방스 2009.01.07 12564
636 전투 vampyr SBABS-Requiem ABS 9(액알) 101 file 담먹캐 2009.11.01 12000
635 HUD rpg 만들기 vx - 맵이름 띠우는 스크립트 ^^ 74 아방스 2008.01.27 11924
634 HUD PRABS v1.0 [hud,주석액알,원거리공격,hotkeys,vx] 대박감이다. 47 유칸지 2008.08.13 11114
633 전투 사이드뷰배틀3.3 + ATB1.1 스크립트. 65 할렘 2009.02.01 10946
632 전투 ORBS [새로운 전투 방식] 48 file 아방스 2009.03.04 10210
631 그래픽 3D그래픽 파티클엔진 45 file RPGbooster 2008.10.08 10130
630 전투 rpgvx 간단액알 스크립트 제작: 41 *PS 2008.02.07 9822
629 메뉴 (모그메뉴 풀세트팩 SEL Style.) 유니크급 자료 147 file 할렘 2009.02.07 9558
628 전투 RPG Tankentai SBS 3.3 + ATB Kaduki Eng 58 아방스 2009.02.05 9071
627 전투 ATB전투방식.(사이드뷰X 백발의카임전투방식O) 14 file 이피쿤 2009.06.24 9035
626 메뉴 일본에서 만든 멋있는메뉴변경 스크립트 (한글 VX에서 쓰시면 자동으로 바뀜) 45 유칸지 2008.04.09 8861
625 전투 WGB배틀 시스템. 59 file 카르와푸딩의아틀리에 2009.06.30 8777
624 전투 Crissaegrim ABS 2.0.5 최신 48 file RPGbooster 2008.10.08 8768
623 전투 Requiem ABS 8 - 액션 배틀 시스템 8 36 아방스 2009.06.24 8540
622 전투 RPGTankentai SBS3.3b 버전 (사이드뷰) 21 file 카르와푸딩의아틀리에 2009.07.01 8455
621 전투 사이드뷰 스크립트 [2003 전투 방식] 39 아방스 2008.03.09 8406
620 맵/타일 RPG 만들기 VX 로 구현한 3D~ 42 아방스 2008.09.02 8405
619 메뉴 메뉴변경 스크립트 34 아방스 2008.01.24 7937
618 전투 PRABS 2.0 액션배틀시스템 58 file RPGbooster 2008.10.08 7575
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