Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # [Xp] Automatic Door
- # Version: 1.00
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #==============================================================================
- # ■ Game_Event
- #------------------------------------------------------------------------------
- # イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理
- # イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。
- #==============================================================================
- class Game_Event < Game_Character
- attr_reader :name
- #--------------------------------------------------------------------------
- # ● initialize
- #--------------------------------------------------------------------------
- alias drago_event_auto_initialize initialize
- def initialize(map_id, event)
- @name = event.name
- drago_event_auto_initialize(map_id, event)
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias :update_autodoor :update
- def update
- update_autodoor
- about_door
- end
- #--------------------------------------------------------------------------
- # ● ドアの全て
- #--------------------------------------------------------------------------
- def about_door
- if @name[/Door(\d+)/] and @page.through and
- $game_system.map_interpreter.running? == false
- distance = ($game_player.x-@x).abs+($game_player.y-@y).abs
- case distance
- when 0...1
- return if @direction == 8
- door_se($1.to_i * 2) if @direction == 2
- turn_up
- @wait_count = 6
- when 1...2
- return if @direction == 6
- if @direction > 6 and @wait_count > 0
- @wait_count -= 1
- elsif @direction == 8
- turn_right
- @wait_count = 6
- else
- door_se($1.to_i * 2) if @direction == 2
- turn_right
- @wait_count = 6
- end
- when 2...3 #
- return if @direction == 4
- if @direction > 4 and @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($1.to_i * 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($1.to_i * 2 + 1)
- turn_down
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ドアの SE 設定
- #--------------------------------------------------------------------------
- def door_se(type)
- case type
- when 2 then Audio.se_play("Audio/SE/Door_01", 90, 100) rescue nil
- when 3 then Audio.se_play("Audio/SE/Door_02", 90, 100) rescue nil
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement