赞 | 451 |
VIP | 56 |
好人卡 | 75 |
积分 | 424 |
经验 | 124650 |
最后登录 | 2024-11-22 |
在线时间 | 7602 小时 |
Lv5.捕梦者 (管理员) 老黄鸡
- 梦石
- 0
- 星屑
- 42399
- 在线时间
- 7602 小时
- 注册时间
- 2009-7-6
- 帖子
- 13506
|
本帖最后由 fux2 于 2011-8-28 21:57 编辑
jklpgh 发表于 2011-8-25 19:56
又发现个BUG呢,无论角色在那里,只要按下举石头的确定键,石头就呼地一下飞过来呢 ... - #==============================================================================
- # +++ MOG VX - Pick-up and Throw v1.3 +++
- #==============================================================================
- # By Moghunter ,Transplantation by fux2
- module MOG_PICK_THROW
- SPRITE_POSITION = 18
- THROW_SE = "016-Jump02"
- PICK_UP_SE = "015-Jump01"
- THROW_BALLOON_ID = 97
- PICK_UP_BALLOON_ID = 98
- DISABLE_SWITCH_ID = 20
- end
- class Game_Temp
-
- attr_accessor :pickup_lock
- attr_accessor :pickup_lock_time
- attr_accessor :character_pre_name
- attr_accessor :can_throw
- alias mog_pick_initialize initialize
- def initialize
- @pickup_lock = false
- @pickup_lock_time = 0
- @character_pre_name = ""
- @can_throw = true
- mog_pick_initialize
- end
- end
- class Game_Event < Game_Character
-
- attr_accessor :throw_active
- attr_accessor :throw
- attr_accessor :x
- attr_accessor :y
- attr_accessor :move_speed
- attr_accessor :pre_move_speed
- alias mog_pickup_initialize initialize
- def initialize(map_id, event)
- @throw_active = false
- if event.name =~ /<Throw(\d+)>/i
- @throw = $1.to_i
- else
- @throw = 0
- end
- mog_pickup_initialize(map_id, event)
- end
- end
- class Game_Character
- attr_accessor :pre_move_speed
- alias mog_throw_initialize initialize
- def initialize
- mog_throw_initialize
- @pre_move_speed = @move_speed
- end
- def throw_action(range)
- jump_range = range
- @x = $game_player.x
- @y = $game_player.y
- range.times do
- unless jumping?
- case $game_player.direction
- when 6
- jump(jump_range,0) if throw_range?(jump_range,0,jump_range)
- when 4
- jump(-jump_range,0) if throw_range?(-jump_range,0,jump_range)
- when 2
- jump(0,jump_range) if throw_range?(0,jump_range,jump_range)
- when 8
- jump(0,-jump_range) if throw_range?(0,-jump_range,jump_range)
- end
- jump(0,0) if jump_range == 1
- if @x == $game_player.x and @y == $game_player.y and jump_range == 1
- $game_temp.can_throw = false
- end
- jump_range -= 1
- end
- end
- end
- def collide_with_characters?(x, y)
- for event in $game_map.events.values
- if event.x == x && event.y == y
- if event.through
- return true if self.is_a?(Game_Event)
- else
- return false
- end
- end
- end
- return false
- end
-
- alias:sz:screen_z
- def screen_z(height = 0)
- return $game_player.sz(height) + 10 if self.is_a?(Game_Event) && $game_temp.pickup_lock
- sz(height)
- end
- def throw_range?(x, y, range)
- x = $game_player.x
- y = $game_player.y
- case $game_player.direction
- when 2
- y += range
- when 6
- x += range
- when 4
- x -= range
- when 8
- y -= range
- end
- return false if collide_with_characters?(x, y)
- return false unless $game_map.passable?(x, y, $game_player.direction, self)
- return true
- end
- end
- class Game_Player < Game_Character
- include MOG_PICK_THROW
- def img_pickup_exist?
- RPG::Cache.character(@character_name + "_Pickup",@character_hue) rescue return false
- end
- def check_action_event
- return true if check_event_trigger_here([0])
- return check_event_trigger_there([0,1,2])
- end
- alias mog_pickup_check_action_event check_event_trigger_there
- def check_event_trigger_there(ar)
- throw_event
- check_event_pickup([0,1,2])
- mog_pickup_check_action_event(ar)
- end
- def reserve_transfer(map_id, x, y, direction)
- @transferring = true
- @new_map_id = map_id
- @new_x = x
- @new_y = y
- @new_direction = direction
- end
- alias mog_pickup_reserve_transfer reserve_transfer
- def reserve_transfer(map_id, x, y, direction)
- if $game_temp.pickup_lock == true
- for event in $game_map.events.values
- if event.throw_active == true
- event.throw_active = false
- case @direction
- when 2
- event.jump(0,-1)
- when 4
- event.jump(1,0)
- when 6
- event.jump(-1,0)
- when 8
- event.jump(0,1)
- end
- end
- end
- $game_temp.pickup_lock = false
- $game_temp.pickup_lock_time = 0
- @character_name = $game_temp.character_pre_name
- end
- mog_pickup_reserve_transfer(map_id, x, y, direction)
- end
- def move_by_input
- return unless movable?
- return if $game_map.interpreter.running?
- case Input.dir4
- when 2; move_down
- when 4; move_left
- when 6; move_right
- when 8; move_up
- end
- end
-
- alias mog_pickup_move_by_input move_by_input
- def move_by_input
- return if $game_temp.pickup_lock_time > 0
- mog_pickup_move_by_input
- end
- def throw_event
- return if $game_temp.pickup_lock == false
- return if $game_temp.pickup_lock_time > 0
- return if $game_system.map_interpreter.running?
- for event in $game_map.events.values
- if event.throw_active == true and not jumping?
- $game_temp.can_throw = true
- event.throw_action(event.throw)
- $game_temp.pickup_lock_time = 120
- return if $game_temp.can_throw == false
- event.throw_active = false
- $game_temp.pickup_lock = false
- event.move_speed = event.pre_move_speed
- Audio.se_play("Audio/SE/" + THROW_SE, 100, 100)
- $game_player.animation_id = THROW_BALLOON_ID
- @character_name = $game_temp.character_pre_name
- end
- end
- end
- def check_event_pickup(triggers)
- return if $game_temp.pickup_lock == true
- return if $game_temp.pickup_lock_time > 0
- return if $game_system.map_interpreter.running?
- return if $game_switches[DISABLE_SWITCH_ID] == true
- front_x = $game_map.x_with_direction(@x, @direction)
- front_y = $game_map.y_with_direction(@y, @direction)
- for event in $game_map.events.values
- if event.x == $game_player.x+($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0) && event.y == $game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0)
- if event.throw > 0 and not jumping?
- $game_temp.pickup_lock_time = 120
- event.throw_active = true
- $game_temp.pickup_lock = true
- event.jump(0,0)
- event.x = @x
- event.y = @y
- event.pre_move_speed = event.move_speed
- event.move_speed = 5
- $game_player.animation_id = PICK_UP_BALLOON_ID
- Audio.se_play("Audio/SE/" + PICK_UP_SE, 100, 100)
- $game_temp.character_pre_name = @character_name
- if img_pickup_exist?
- @character_name = @character_name + "_Pickup"
- end
- end
- end
- end
- end
- end
- class Game_Map
- def x_with_direction(x, direction)
- return x + (direction == 6 ? 1 : direction == 4 ? -1 : 0)
- end
- def y_with_direction(y, direction)
- return y + (direction == 2 ? 1 : direction == 8 ? -1 : 0)
- end
- end
- class Sprite_Character
- include MOG_PICK_THROW
- alias mog_pickup_update update
- def update
- mog_pickup_update
- update_pickup_position
- end
-
- def update_pickup_position
- $game_temp.pickup_lock_time -= 1 if $game_temp.pickup_lock_time > 0
- if @character.is_a?(Game_Event)
- if @character.throw_active == true and not @character.jumping?
- @character.x = $game_player.x
- @character.y = $game_player.y
- self.x = $game_player.screen_x
- self.y = $game_player.screen_y - SPRITE_POSITION
- self.z = $game_player.screen_z + 1000
- end
- end
- end
- end
- class Scene_Map
- alias mog_pickup_call_menu call_menu
- def call_menu
- return if $game_temp.pickup_lock == true
- mog_pickup_call_menu
- end
-
- alias mog_pickup_call_save call_save
- def call_save
- return if $game_temp.pickup_lock == true
- mog_pickup_call_save
- end
- end
- $mog_rgssvx_pickup_throw = true
复制代码 |
|