RPGXP 스크립트

텔레포트 스크립트

by posted Oct 01, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

#=================================================
# ㉿ 텔레포트 이동 스크립트
#-------------------------------------------------
# 기존 대쉬를 이용하여 플레이어를 순간이동 시키도록
# 만든 스크립트 이다. 움직이는 동안 Z(D) 키를 누른다.
#
# 수정 자: kcss(통역: Mania)
#=================================================

Animation = 1 # 애니메이션(애니메이션 번호)
Con_sp = 15 # 마나 소비 수

class Game_Player
  alias teleport_update update
  def update
    if Input.trigger?(Input::Z) # Z(D) 키를 눌렀을 때 시작
      unless $game_party.actors[0].sp < Con_sp
        case @direction
        when 2 # 아래
          if Input.press?(Input::DOWN)
            $game_player.animation_id = Animation
            $game_party.actors[0].sp -= Con_sp
            moveto($game_player.x, $game_player.y+2) # 아래로 가는 수
          else
            moveto($game_player.x, $game_player.y)
          end
          when 4 # 왼쪽
            if Input.press?(Input::LEFT)
              $game_player.animation_id = Animation
              $game_party.actors[0].sp -= Con_sp
              moveto($game_player.x-2, $game_player.y) # 왼쪽으로 가는 수
            else
              moveto($game_player.x, $game_player.y)
            end
            when 6 # 오른쪽
              if Input.press?(Input::RIGHT)
                $game_player.animation_id = Animation
                $game_party.actors[0].sp -= Con_sp
                moveto($game_player.x+2, $game_player.y) # 오른쪽으로 가는 수
              else
                moveto($game_player.x, $game_player.y)
              end
              when 8 # 위
                if Input.press?(Input::UP)
                  $game_player.animation_id = Animation
                  $game_party.actors[0].sp -= Con_sp
                  moveto($game_player.x, $game_player.y-2) # 위로 가는 수
                else
                  moveto($game_player.x, $game_player.y)
                end
              end
            end
          end
          teleport_update
        end
      end