Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # [Xp/Vx-VxA] Automatic Door
- # Version: 2.00
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #==============================================================================
- # ■ Game_Event
- #------------------------------------------------------------------------------
- # イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理
- # イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。
- #==============================================================================
- class Game_Event < Game_Character
- VX = defined?(Window_ActorCommand)
- VXA = defined?(Window_BattleActor)
- DOOR_SOUND = ["Audio.se_play('Audio/SE/Open1', 90, 100)", # Opened Door
- "Audio.se_play('Audio/SE/Close1', 90, 100)"] # Closed Door
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias :drg145_upd :update unless method_defined?(:drg145_upd)
- def update
- drg145_upd
- update_autodoor
- end
- #--------------------------------------------------------------------------
- # ● ドアの全て
- #--------------------------------------------------------------------------
- def update_autodoor
- interpreter = VX ? $game_map.interpreter.running? :
- $game_system.map_interpreter.running?
- if @event.name =~ /Door/i && @page.through && !interpreter
- distance,type = ($game_player.real_x-@real_x).abs+
- ($game_player.real_y-@real_y).abs, 1
- number = VXA ? [0.5,1.0,1.5] : VX ? [216,232,248] : [128,132,148]
- distance = [distance-32,0].max if !VXA
- case distance
- when 0...number[0]
- return if @direction == 8
- door_se(type * 2) if @direction == 2
- turn_up
- @wait_count = 6
- when number[0]...number[1]
- return if @direction == 6
- if @direction > 6 && @wait_count > 0
- @wait_count -= 1
- elsif @direction == 8
- turn_right
- @wait_count = 6
- else
- door_se(type * 2) if @direction == 2
- turn_right
- @wait_count = 6
- end
- when number[1]...number[2] #
- return if @direction == 4
- if @direction > 4 && @wait_count > 0
- @wait_count -= 1
- elsif @direction == 8
- turn_right
- @wait_count = 6
- elsif @direction == 6
- turn_left
- @wait_count = 6
- else
- door_se(type * 2) if @direction == 2
- turn_left
- @wait_count = 6
- end
- else
- return if @direction == 2
- if @direction > 2 and @wait_count > 0
- @wait_count -= 1
- elsif @direction == 8
- turn_right
- @wait_count = 6
- elsif @direction == 6
- turn_left
- @wait_count = 6
- elsif @direction == 4
- door_se(type * 2 + 1)
- turn_down
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● セト ヂレクシオン
- #--------------------------------------------------------------------------
- if VXA
- def turn_up() set_direction(8) end
- def turn_right()set_direction(6) end
- def turn_left() set_direction(4) end
- def turn_down() set_direction(2) end
- end
- #--------------------------------------------------------------------------
- # ● ドアの SE 設定
- #--------------------------------------------------------------------------
- def door_se(type)
- case type
- when 2 then eval(DOOR_SOUND[0]) rescue nil
- when 3 then eval(DOOR_SOUND[1]) rescue nil
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement