PHP-Code:
# ‘S•Œƒhƒbƒgˆ“ Ver ƒ+++ # ”z•zŒEƒTƒ|[ƒgURL # http://members.jcom.home.ne.jp/cogwheel/ #============================================================================== # Game_Player #------------------------------------------------------------------------------ # @ƒvƒŒƒCƒ„[‚ˆ‚ƒNƒ‰ƒX‚‚BƒCƒxƒ“ƒg‚‹N“”’‚Aƒ}ƒbƒv‚ƒXƒNƒ[ƒ‹‚‚‚ # ‹@”\‚Ž‚‚‚‚‚B‚‚ƒNƒ‰ƒX‚ƒCƒ“ƒXƒ^ƒ“ƒX‚ $game_player ‚ŽQ‚‚‚‚B #============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # œ ’” #-------------------------------------------------------------------------- UP = 0 # •Œ‚—]—T(0 <= UP <= 63) SIDE = 0 # ‰E•Œ‚—]—T(0 <= SIDE <= 63) SLANT = false # ˆ“ƒ‹[ƒg‚Ž‚ˆ“ŽžA‘“xC #-------------------------------------------------------------------------- # œ ŒŠJƒCƒ“ƒXƒ^ƒ“ƒX•ϐ” #-------------------------------------------------------------------------- attr_reader : walk # ƒvƒŒ[ƒ„[ˆ“‘“x attr_reader : event # ƒCƒxƒ“ƒgŽžˆ“‘“x attr_accessor : move_speed # ˆ“‘“x #-------------------------------------------------------------------------- # œ ƒIƒuƒWƒFƒNƒg‰Š‰ #-------------------------------------------------------------------------- def initialize super # @walk:•s‘“x @dash:ƒ_ƒbƒVƒ…Žžˆ“‘“x # @event:ƒCƒxƒ“ƒgŽžˆ“‘“xi0‚Žž‚́AƒCƒxƒ“ƒgŽž‚‘“x•ύX‚‚‚‚j @ walk = 4 @ dash = 5 @ event = 4 @ dot_m = true @ revise_x = 0 @ revise_y = 0 @ move == false end #-------------------------------------------------------------------------- # œ ƒtƒŒ[ƒ€XV #-------------------------------------------------------------------------- alias : update_original : update def update #ƒ_ƒbƒVƒ…‹@”\BƒGƒ“ƒ^[ƒL[‚‰Ÿ‚‚‚‚‚ŠԁAˆ“‘“x‚•ύX‚‚B unless moving ? or $game_system . map_interpreter . running ? or @ move_route_forcing or $game_temp . message_window_showing if @ walk != @ dash if Input . press ?( Input :: C ) if @ move_speed != @ dash @ move_speed = @ dash end else if @ move_speed != @ walk @ move_speed = @ walk end end end end if @ revise_x == nil and @ revise_y == nil @ revise_x = 0 @ revise_y = 0 end unless @ dot_m update_original return end if @ move_route_forcing # ƒ[ƒJƒ‹•ϐ”‚ˆ“’†‚‚‚‚‚‹L‰ last_moving = moving ? # ƒ[ƒJƒ‹•ϐ”‚ɍ•W‚‹L‰ last_real_x = @ real_x last_real_y = @ real_y # •W‚‚‚‚‚‚‡ if (@ revise_x != 0 or @ revise_y != 0 ) and not jumping ? and @ move == true if @ revise_x != @ real_x - @ x * 128 or @ revise_y != @ real_y - @ y * 128 @ revise_x = @ real_x - @ x * 128 @ revise_y = @ real_y - @ y * 128 end # ˆ“‹——distance1‚–•W‹——distance2‚’ distance1 = 2 ** @ move_speed distance2 = Math . sqrt (@ revise_x ** 2 + @ revise_y ** 2 ) # ˆ“‹——‚–•W‹——‚‰z‚‚‡ if distance1 > distance2 # ‹•“I‚••W‚—‚‚‚ @ real_x = @ real_x - @ revise_x @ real_y = @ real_y - @ revise_y @ revise_x = 0 @ revise_y = 0 anime_update # ˆ“‹——‚–•W‹——‚’B‚‚‚‡ else # ˆ“‹——•–•W‹——‚‹‚‚• @ real_x -= ( distance1 * @ revise_x / distance2 ). round @ real_y -= ( distance1 * @ revise_y / distance2 ). round @ revise_x = @ real_x - @ x * 128 @ revise_y = @ real_y - @ y * 128 anime_update end else super end else @ move = false # ˆ“’†AƒCƒxƒ“ƒgŽs’†Aˆ“ƒ‹[ƒg‹•’†A # ƒƒbƒZ[ƒWƒEƒBƒ“ƒhƒE•\Ž’†‚‚‚‚‚‚‚‚‡ unless moving ? or $game_system . map_interpreter . running ? or @ move_route_forcing or $game_temp . message_window_showing @ event_run = false # •Œƒ{ƒ^ƒ“‚‰Ÿ‚‚‚‚‚‚A‚‚•Œ‚ƒvƒŒƒCƒ„[‚ˆ“ case Input . dir8 when 1 move_lower_left_p when 2 move_down_p when 3 move_lower_right_p when 4 move_left_p when 6 move_right_p when 7 move_upper_left_p when 8 move_up_p when 9 move_upper_right_p end end # ƒ[ƒJƒ‹•ϐ”‚ɍ•W‚‹L‰ last_real_x = @ real_x last_real_y = @ real_y # ˆ“ˆ— @ real_x = @ x * 128 + @ revise_x @ real_y = @ y * 128 + @ revise_y # ƒ[ƒJƒ‹•ϐ”‚ˆ“’†‚‚‚‚‚‹L‰ last_moving = moving ? # •WXV move_on # Œ‚̍•W‚ˆ‘O‚̍•W‚ˆ‚‚‡ if ( last_real_x != @ real_x or last_real_y != @ real_y ) @ move_distance = 0 if @ move_distance == nil @ move_distance += Math . sqrt (( last_real_x - @ real_x ) ** 2 + ( last_real_y - @ real_y ) ** 2 ) if @ move_distance >= 128 @ move_distance %= 128 increase_steps end # ƒAƒjƒ[ƒVƒ‡ƒ“‚XV anime_update elsif @ walk_anime @ pattern = @ original_pattern end end # ƒLƒƒƒ‰ƒNƒ^[‚‰‚ˆ“‚A‚‚‰–ʏ‚ˆ’u‚’†‰›‚‚‰‚̏‡ if @ real_y > last_real_y and @ real_y - $game_map . display_y > CENTER_Y # ƒ}ƒbƒv‚‰‚ƒXƒNƒ[ƒ‹ $game_map . scroll_down (@ real_y - last_real_y ) end # ƒLƒƒƒ‰ƒNƒ^[‚‚ˆ“‚A‚‚‰–ʏ‚ˆ’u‚’†‰›‚‚荶‚̏‡ if @ real_x < last_real_x and @ real_x - $game_map . display_x < CENTER_X # ƒ}ƒbƒv‚‚ƒXƒNƒ[ƒ‹ $game_map . scroll_left ( last_real_x - @ real_x ) end # ƒLƒƒƒ‰ƒNƒ^[‚‰E‚ˆ“‚A‚‚‰–ʏ‚ˆ’u‚’†‰›‚‚‰E‚̏‡ if @ real_x > last_real_x and @ real_x - $game_map . display_x > CENTER_X # ƒ}ƒbƒv‚‰E‚ƒXƒNƒ[ƒ‹ $game_map . scroll_right (@ real_x - last_real_x ) end # ƒLƒƒƒ‰ƒNƒ^[‚‚ˆ“‚A‚‚‰–ʏ‚ˆ’u‚’†‰›‚‚‚̏‡ if @ real_y < last_real_y and @ real_y - $game_map . display_y < CENTER_Y # ƒ}ƒbƒv‚‚ƒXƒNƒ[ƒ‹ $game_map . scroll_up ( last_real_y - @ real_y ) end # ‘O‰ƒvƒŒƒCƒ„[‚ˆ“’†‚‚‚‡ if last_moving # “ˆ’u‚ƒCƒxƒ“ƒg‚‚̐ڐG‚‚‚ƒCƒxƒ“ƒg‹N“”’ result = check_event_trigger_here ([ 1 , 2 ]) if result == true if ( last_real_x / 128.0 ). round != @ x and ( last_real_y / 128.0 ). round != @ y if @ direction == 2 or @ direction == 8 if ( last_real_x / 128.0 ). round > @ x turn_left else turn_right end else if ( last_real_y / 128.0 ). round > @ y turn_up else turn_down end end elsif ( last_real_x / 128.0 ). round > @ x turn_left elsif ( last_real_x / 128.0 ). round < @ x turn_right elsif ( last_real_y / 128.0 ). round > @ y turn_up elsif ( last_real_y / 128.0 ). round < @ y turn_down end end # ‹N“‚‚ƒCƒxƒ“ƒg‚‚‚‡ if result == false # ƒfƒoƒbƒOƒ‚[ƒh‚ ON ‚‚ CTRL ƒL[‚‰Ÿ‚‚‚‚‚‡‚œ‚ unless $DEBUG and Input . press ?( Input :: CTRL ) # ƒGƒ“ƒJƒEƒ“ƒg ƒJƒEƒ“ƒgƒ_ƒEƒ“ if @ encounter_count > 0 @ encounter_count -= 1 end end end end # C ƒ{ƒ^ƒ“‚‰Ÿ‚‚‚‡ if Input . trigger ?( Input :: C ) # “ˆ’u‚‚‚ѐ–‚ƒCƒxƒ“ƒg‹N“”’ check_event_trigger_here ([ 0 ]) check_event_trigger_there ([ 0 , 1 , 2 ]) end end #-------------------------------------------------------------------------- # œ ˆ“”’ #-------------------------------------------------------------------------- def moving ? unless @ dot_m result = super return result end # ‹•ˆ“‚̏‡ƒIƒŠƒWƒiƒ‹‚”’‚‚‚‚ if @ move_route_forcing if @ move == false return false end super # ’ʏŽž‚Œ•W‚Ž•W‚ˆ‚‚‡‚‚ˆ“’†‚”’ else return (@ x != (@ real_x / 128.0 ). round or @ y != (@ real_y / 128.0 ). round ) end end #-------------------------------------------------------------------------- # œ ˆ“”’ #-------------------------------------------------------------------------- def moving_a ? if @ move == false if (@ move_route .list[@ move_route_index ]. code <= 14 or @ move_route .list[@ move_route_index ]. code == 25 ) @ move = true end return false end moving ? end #-------------------------------------------------------------------------- # œ ƒtƒŒ[ƒ€XV (ƒWƒƒƒ“ƒv) #-------------------------------------------------------------------------- def update_jump # ƒWƒƒƒ“ƒvƒJƒEƒ“ƒg‚ 1 Œ‚‚ @ jump_count -= 1 # V‚‚•W‚ŒvŽZ @ real_x = (@ real_x * @ jump_count + @ x * 128 ) / (@ jump_count + 1 ) @ real_y = (@ real_y * @ jump_count + @ y * 128 ) / (@ jump_count + 1 ) if @ jump_count == 0 @ revise_x = 0 @ revise_y = 0 end end #-------------------------------------------------------------------------- # œ ˆ“ƒ^ƒCƒv : ƒJƒXƒ^ƒ€ #-------------------------------------------------------------------------- def move_type_custom unless @ dot_m super return end # ’Ž~’†‚‚‚‚‚’†’f if jumping ? or moving_a ? return end # ˆ“ƒRƒ}ƒ“ƒh‚ƒŠƒXƒg‚̍Œ‚“ž’B‚‚‚‚ƒ‹[ƒv while @ move_route_index < @ move_route .list. size # ˆ“ƒRƒ}ƒ“ƒh‚Ž“ command = @ move_route .list[@ move_route_index ] # ƒRƒ}ƒ“ƒhƒR[ƒh 0 ” (ƒŠƒXƒg‚̍Œ) ‚̏‡ if command . code == 0 # ƒIƒvƒVƒ‡ƒ“ [“‚ŒJ‚•‚] ‚ ON ‚̏‡ if @ move_route . repeat # ˆ“ƒ‹[ƒg‚ƒCƒ“ƒfƒbƒNƒX‚ŏ‰‚–‚ @ move_route_index = 0 end # ƒIƒvƒVƒ‡ƒ“ [“‚ŒJ‚•‚] ‚ OFF ‚̏‡ unless @ move_route . repeat # ˆ“ƒ‹[ƒg‹•’†‚̏‡ if @ move_route_forcing and not @ move_route . repeat # ˆ“ƒ‹[ƒg‚‹•‚‰œ @ move_route_forcing = false # ƒIƒŠƒWƒiƒ‹‚ˆ“ƒ‹[ƒg‚•œ‹A @ move_route = @ original_move_route @ move_route_index = @ original_move_route_index @ original_move_route = nil end # ’Ž~ƒJƒEƒ“ƒg‚ƒNƒŠƒA @ stop_count = 0 end return end # ˆ“ŒnƒRƒ}ƒ“ƒh (‰‚ˆ“`ƒWƒƒƒ“ƒv) ‚̏‡ if command . code <= 14 # ƒRƒ}ƒ“ƒhƒR[ƒh‚•Š case command . code when 1 # ‰‚ˆ“ move_down when 2 # ‚ˆ“ move_left when 3 # ‰E‚ˆ“ move_right when 4 # ‚ˆ“ move_up when 5 # ‰‚ˆ“ move_lower_left when 6 # ‰E‰‚ˆ“ move_lower_right when 7 # ‚ˆ“ move_upper_left when 8 # ‰E‚ˆ“ move_upper_right when 9 # ƒ‰ƒ“ƒ_ƒ€‚ˆ“ move_random when 10 # ƒvƒŒƒCƒ„[‚‹‚‚• move_toward_player when 11 # ƒvƒŒƒCƒ„[‚‚‰“‚‚‚ move_away_from_player when 12 # ˆ•‘Oi move_forward when 13 # ˆ•Œ‘ move_backward when 14 # ƒWƒƒƒ“ƒv jump ( command . parameters [ 0 ], command . parameters [ 1 ]) end # ƒIƒvƒVƒ‡ƒ“ [ˆ“‚‚‚‚‡‚–Ž‹] ‚ OFF ‚ŁAˆ“Ž”s‚̏‡ if not @ move_route . skippable and not moving ? and not jumping ? return end @ move_route_index += 1 return end # ƒEƒFƒCƒg‚̏‡ if command . code == 15 # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚’ @ wait_count = command . parameters [ 0 ] * 2 - 1 @ move_route_index += 1 return end # Œ‚•ύXŒn‚ƒRƒ}ƒ“ƒh‚̏‡ if command . code >= 16 and command . code <= 26 # ƒRƒ}ƒ“ƒhƒR[ƒh‚•Š case command . code when 16 # ‰‚Œ‚• turn_down when 17 # ‚Œ‚• turn_left when 18 # ‰E‚Œ‚• turn_right when 19 # ‚Œ‚• turn_up when 20 # ‰E‚ 90 “x‰“] turn_right_90 when 21 # ‚ 90 “x‰“] turn_left_90 when 22 # 180 “x‰“] turn_180 when 23 # ‰E‚‚ 90 “x‰“] turn_right_or_left_90 when 24 # ƒ‰ƒ“ƒ_ƒ€‚•Œ“]Š turn_random when 25 # ƒvƒŒƒCƒ„[‚•‚Œ‚• turn_toward_player when 26 # ƒvƒŒƒCƒ„[‚‹t‚Œ‚• turn_away_from_player end @ move_route_index += 1 return end # ‚‚‘‚ƒRƒ}ƒ“ƒh‚̏‡ if command . code >= 27 # ƒRƒ}ƒ“ƒhƒR[ƒh‚•Š case command . code when 27 # ƒXƒCƒbƒ` ON $game_switches [ command . parameters [ 0 ]] = true $game_map . need_refresh = true when 28 # ƒXƒCƒbƒ` OFF $game_switches [ command . parameters [ 0 ]] = false $game_map . need_refresh = true when 29 # ˆ“‘“x‚•ύX @ move_speed = command . parameters [ 0 ] when 30 # ˆ“•p“x‚•ύX @ move_frequency = command . parameters [ 0 ] when 31 # ˆ“ŽžƒAƒjƒ ON @ walk_anime = true when 32 # ˆ“ŽžƒAƒjƒ OFF @ walk_anime = false when 33 # ’Ž~ŽžƒAƒjƒ ON @ step_anime = true when 34 # ’Ž~ŽžƒAƒjƒ OFF @ step_anime = false when 35 # Œ‚Œ’ ON @ direction_fix = true when 36 # Œ‚Œ’ OFF @ direction_fix = false when 37 # ‚‚”‚ ON @ through = true when 38 # ‚‚”‚ OFF @ through = false when 39 # ‘O–‚•\Ž ON @ always_on_top = true when 40 # ‘O–‚•\Ž OFF @ always_on_top = false when 41 # ƒOƒ‰ƒtƒBƒbƒN•ύX @ tile_id = 0 @ character_name = command . parameters [ 0 ] @ character_hue = command . parameters [ 1 ] if @ original_direction != command . parameters [ 2 ] @ direction = command . parameters [ 2 ] @ original_direction = @ direction @ prelock_direction = 0 end if @ original_pattern != command . parameters [ 3 ] @ pattern = command . parameters [ 3 ] @ original_pattern = @ pattern end when 42 # •s“–“x‚•ύX @ opacity = command . parameters [ 0 ] when 43 # ‡•–@‚•ύX @ blend_type = command . parameters [ 0 ] when 44 # SE ‚‰‰‘t $game_system . se_play ( command . parameters [ 0 ]) when 45 # ƒXƒNƒŠƒvƒg result = eval( command . parameters [ 0 ]) end @ move_route_index += 1 return end end end #-------------------------------------------------------------------------- # œ ‰‚ˆ“ #-------------------------------------------------------------------------- def move_down_p # ‰‚Œ‚• turn_down # ˆ“‹——‚ŽZo distance = 2 ** @ move_speed down1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance , true ) end #-------------------------------------------------------------------------- # œ ‰‚ˆ“‰”\‚‚‚‚‚”’‚P #-------------------------------------------------------------------------- def down1 ( x , y , distance , down = false ) result = down2 ( x , y , distance ) if result == false @ event_run = check_event_trigger_touch ( x , y + 1 ) return result end if @ revise_x < - SIDE result = down2 ( x , y + 1 , distance , 4 ) result &= down2 ( x - 1 , y , distance ) if result == false if down move_lower_right_p if @ revise_x > SIDE @ revise_x = SIDE end end return result end elsif @ revise_x > SIDE result = down2 ( x , y + 1 , distance , 6 ) result &= down2 ( x + 1 , y , distance ) if result == false if down move_lower_left_p if @ revise_x < - SIDE @ revise_x = - SIDE end end return result end end # ‰‚ˆ“‰”\‚‚‚‹——•ˆ“ @ revise_y += distance return result end #-------------------------------------------------------------------------- # œ ‰‚ˆ“‰”\‚‚‚‚‚”’‚Q #-------------------------------------------------------------------------- def down2 ( x , y , distance , d = 2 ) if @ revise_y + distance > 0 unless passable ?( x , y , d ) if @ revise_y < 0 @ revise_y = 0 end return false end end return true end #-------------------------------------------------------------------------- # œ ‚ˆ“ #-------------------------------------------------------------------------- def move_left_p # ‚Œ‚• turn_left distance = 2 ** @ move_speed left1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance , true ) end #-------------------------------------------------------------------------- # œ ‚ˆ“‰”\‚‚‚‚‚”’‚P #-------------------------------------------------------------------------- def left1 ( x , y , distance , left = false ) result = left2 ( x , y , distance ) if result == false @ event_run = check_event_trigger_touch ( x - 1 , y ) return result end if @ revise_y < - UP result = left2 ( x - 1 , y , distance , 8 ) result &= left2 ( x , y - 1 , distance ) if result == false if left move_lower_left_p if @ revise_y > 0 @ revise_y = 0 end end return result end elsif @ revise_y > 0 result = left2 ( x - 1 , y , distance , 2 ) result &= left2 ( x , y + 1 , distance ) if result == false if left move_upper_left_p if @ revise_y < - UP @ revise_y = - UP end end return result end end @ revise_x -= distance return result end #-------------------------------------------------------------------------- # œ ‚ˆ“‰”\‚‚‚‚‚”’‚Q #-------------------------------------------------------------------------- def left2 ( x , y , distance , d = 4 ) if @ revise_x - distance < - SIDE unless passable ?( x , y , d ) if @ revise_x > - SIDE @ revise_x = - SIDE end return false end end return true end #-------------------------------------------------------------------------- # œ ‰E‚ˆ“ #-------------------------------------------------------------------------- def move_right_p # ‰E‚Œ‚• turn_right distance = 2 ** @ move_speed right1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance , true ) end #-------------------------------------------------------------------------- # œ ‰E‚ˆ“‰”\‚‚‚‚‚”’‚P #-------------------------------------------------------------------------- def right1 ( x , y , distance , right = false ) result = right2 ( x , y , distance ) if result == false @ event_run = check_event_trigger_touch ( x + 1 , y ) return result end if @ revise_y < - UP result = right2 ( x + 1 , y , distance , 8 ) result &= right2 ( x , y - 1 , distance ) if result == false if right move_lower_right_p if @ revise_y > 0 @ revise_y = 0 end end return result end elsif @ revise_y > 0 result = right2 ( x + 1 , y , distance , 2 ) result &= right2 ( x , y + 1 , distance ) if result == false if right move_upper_right_p if @ revise_y < - UP @ revise_y = - UP end end return result end end @ revise_x += distance return result end #-------------------------------------------------------------------------- # œ ‰E‚ˆ“‰”\‚‚‚‚‚”’‚Q #-------------------------------------------------------------------------- def right2 ( x , y , distance , d = 6 ) if @ revise_x + distance > SIDE unless passable ?( x , y , d ) if @ revise_x < SIDE @ revise_x = SIDE end return false end end return true end #-------------------------------------------------------------------------- # œ ‚ˆ“ #-------------------------------------------------------------------------- def move_up_p # ‚Œ‚• turn_up # ‰‚ˆ“ distance = 2 ** @ move_speed up1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance , true ) end #-------------------------------------------------------------------------- # œ ‚ˆ“‰”\‚‚‚‚‚”’‚P #-------------------------------------------------------------------------- def up1 ( x , y , distance , up = false ) result = up2 ( x , y , distance ) if result == false @ event_run = check_event_trigger_touch ( x , y - 1 ) return result end if @ revise_x < - SIDE result = up2 ( x , y - 1 , distance , 4 ) result &= up2 ( x - 1 , y , distance ) if result == false if up move_upper_right_p if @ revise_x > SIDE @ revise_x = SIDE end end return result end elsif @ revise_x > SIDE result = up2 ( x , y - 1 , distance , 6 ) result &= up2 ( x + 1 , y , distance ) if result == false if up move_upper_left_p if @ revise_x < - SIDE @ revise_x = - SIDE end end return result end end @ revise_y -= distance return result end #-------------------------------------------------------------------------- # œ ‚ˆ“‰”\‚‚‚‚‚”’‚Q #-------------------------------------------------------------------------- def up2 ( x , y , distance , d = 8 ) if @ revise_y - distance < - UP unless passable ?( x , y , d ) if @ revise_y > - UP @ revise_y = - UP end return false end end return true end #-------------------------------------------------------------------------- # œ ‰‚ˆ“ #-------------------------------------------------------------------------- def move_lower_left_p # Œ‚Œ’‚‚‚‡ unless @ direction_fix # ‰EŒ‚‚‚‚‡‚͍‚AŒ‚‚‚‚‡‚‰‚Œ‚• @ direction = (@ direction == 6 ? 4 : @ direction == 8 ? 2 : @ direction ) end # ‰‚ˆ“ distance = ( 2 ** @ move_speed ) / Math . sqrt ( 2 ) if @ direction == 2 turn_left unless down1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_down if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 2 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_y > 0 and - UP > @ revise_y - distance @ revise_y = 0 end turn_down unless left1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_left if @ event_run end else turn_down unless left1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_left if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 4 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_x + distance > SIDE and - SIDE > @ revise_x @ revise_x = - SIDE end turn_left unless down1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_down if @ event_run end end end #-------------------------------------------------------------------------- # œ ‰E‰‚ˆ“ #-------------------------------------------------------------------------- def move_lower_right_p # Œ‚Œ’‚‚‚‡ unless @ direction_fix # Œ‚‚‚‚‡‚‰E‚AŒ‚‚‚‚‡‚‰‚Œ‚• @ direction = (@ direction == 4 ? 6 : @ direction == 8 ? 2 : @ direction ) end # ‰E‰‚ˆ“ distance = ( 2 ** @ move_speed ) / Math . sqrt ( 2 ) if @ direction == 2 turn_right unless down1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_down if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 2 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_y > 0 and - UP > @ revise_y - distance @ revise_y = 0 end turn_down unless right1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_right if @ event_run end else turn_down unless right1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_right if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 6 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_x > SIDE and - SIDE > @ revise_x - distance @ revise_x = SIDE end turn_right unless down1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_down if @ event_run end end end #-------------------------------------------------------------------------- # œ ‚ˆ“ #-------------------------------------------------------------------------- def move_upper_left_p # Œ‚Œ’‚‚‚‡ unless @ direction_fix # ‰EŒ‚‚‚‚‡‚͍‚A‰Œ‚‚‚‚‡‚͏‚Œ‚• @ direction = (@ direction == 6 ? 4 : @ direction == 2 ? 8 : @ direction ) end # ‚ˆ“ distance = ( 2 ** @ move_speed ) / Math . sqrt ( 2 ) if @ direction == 8 turn_left unless up1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_up if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 8 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_y + distance > 0 and - UP > @ revise_y @ revise_y = - UP end turn_up unless left1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_left if @ event_run end else turn_up unless left1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_left if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 4 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_x > SIDE and - SIDE > @ revise_x - distance @ revise_x = SIDE end turn_left unless up1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_up if @ event_run end end end #-------------------------------------------------------------------------- # œ ‰E‚ˆ“ #-------------------------------------------------------------------------- def move_upper_right_p # Œ‚Œ’‚‚‚‡ unless @ direction_fix # Œ‚‚‚‚‡‚‰E‚A‰Œ‚‚‚‚‡‚͏‚Œ‚• @ direction = (@ direction == 4 ? 6 : @ direction == 2 ? 8 : @ direction ) end # ‰E‚ˆ“ distance = ( 2 ** @ move_speed ) / Math . sqrt ( 2 ) if @ direction == 8 turn_right unless up1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_up if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 8 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_y + distance > 0 and - UP > @ revise_y @ revise_y = - UP end turn_up unless right1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_right if @ event_run end else turn_up unless right1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_right if @ event_run unless @ event_run if last_move ?(@ real_x , @ real_y , 6 , distance ) result = check_event_trigger_here ([ 1 , 2 ], false ) if result == true return end end move_on if @ revise_x > SIDE and - SIDE > @ revise_x - distance @ revise_x = SIDE end turn_right unless up1 (((@ x * 128 + @ revise_x ) / 128.0 ). round , ((@ y * 128 + @ revise_y ) / 128.0 ). round , distance ) turn_up if @ event_run end end end #-------------------------------------------------------------------------- # œ “ˆ’u‚ƒCƒxƒ“ƒg‹N“”’ #-------------------------------------------------------------------------- def check_event_trigger_here ( triggers , run = true ) result = false # ƒCƒxƒ“ƒgŽs’†‚̏‡ if $game_system . map_interpreter . running ? return result end # ‘SƒCƒxƒ“ƒg‚ƒ‹[ƒv for event in $game_map . events . values # ƒCƒxƒ“ƒg‚̍•W‚ƒgƒŠƒK[‚ˆ’v‚‚‡ if event . x == ((@ x * 128 + @ revise_x ) / 128.0 ). round and event . y == ((@ y * 128 + @ revise_y ) / 128.0 ). round and triggers .include?( event . trigger ) # ƒWƒƒƒ“ƒv’†ˆŠO‚ŁA‹N“”’‚“ˆ’u‚ƒCƒxƒ“ƒg‚‚ if not event . jumping ? and event . over_trigger ? if event .list. size > 1 if run == true event . start end result = true end end end end return result end #-------------------------------------------------------------------------- # œ •WC #-------------------------------------------------------------------------- def move_on if @ y < (@ y + @ revise_y / 128.0 ). round @ y += 1 @ revise_y -= 128 end if @ x > (@ x + @ revise_x / 128.0 ). round @ x -= 1 @ revise_x += 128 end if @ x < (@ x + @ revise_x / 128.0 ). round @ x += 1 @ revise_x -= 128 end if @ y > (@ y + @ revise_y / 128.0 ). round @ y -= 1 @ revise_y += 128 end end #-------------------------------------------------------------------------- # œ ƒAƒjƒ[ƒVƒ‡ƒ“ƒAƒbƒvƒf[ƒg #-------------------------------------------------------------------------- def anime_update # ˆ“ŽžƒAƒjƒ‚ ON ‚̏‡ if @ walk_anime # ƒAƒjƒƒJƒEƒ“ƒg‚ 1.5 ‘‚‚ @ anime_count += 1.5 # ˆ“ŽžƒAƒjƒ‚ OFF ‚ŁA’Ž~ŽžƒAƒjƒ‚ ON ‚̏‡ elsif @ step_anime # ƒAƒjƒƒJƒEƒ“ƒg‚ 1 ‘‚‚ @ anime_count += 1 end # ƒAƒjƒƒJƒEƒ“ƒg‚‘’l‚’‚‚‡ # ‘’l‚́AŠ–{’l 18 ‚‚ˆ“‘“x * 1 ‚ˆ‚‚’l if @ anime_count > 18 - @ move_speed * 2 # ’Ž~ŽžƒAƒjƒ‚ OFF ‚‚ ’Ž~’†‚̏‡ if not @ step_anime and @ stop_count > 0 # ƒpƒ^[ƒ“‚ƒIƒŠƒWƒiƒ‹‚–‚ @ pattern = @ original_pattern # ’Ž~ŽžƒAƒjƒ‚ ON ‚‚‚ ˆ“’†‚̏‡ else # ƒpƒ^[ƒ“‚XV @ pattern = (@ pattern + 1 ) % 4 end # ƒAƒjƒƒJƒEƒ“ƒg‚ƒNƒŠƒA @ anime_count = 0 end end #-------------------------------------------------------------------------- # œ Žw’ˆ’u‚ˆ“ #-------------------------------------------------------------------------- # ƒIƒŠƒWƒiƒ‹‚ƒCƒxƒ“ƒg‚‰– alias : moveto_original : moveto def moveto ( x , y ) # ••W‚‰Š‰ @ revise_x = 0 @ revise_y = 0 # ƒIƒŠƒWƒiƒ‹‚ƒCƒxƒ“ƒg‚Œ‚яo‚ moveto_original ( x , y ) end #-------------------------------------------------------------------------- # œ ˆ“‚‚‚‚‚‚‚”’ #-------------------------------------------------------------------------- def last_move ?( x , y , direction , distance ) if direction == 2 or direction == 6 distance *= - 1 end if ( direction == 2 or direction == 8 ) and ( y / 128.0 ). round != (( y - distance ) / 128.0 ). round return true end if ( direction == 4 or direction == 6 ) and ( x / 128.0 ). round != (( x - distance ) / 128.0 ). round return true end return false end end #============================================================================== # Game_Character (•Š„’‹` 1) #------------------------------------------------------------------------------ # @ƒLƒƒƒ‰ƒNƒ^[‚ˆ‚ƒNƒ‰ƒX‚‚B‚‚ƒNƒ‰ƒX‚ Game_Player ƒNƒ‰ƒX‚ Game_Event # ƒNƒ‰ƒX‚ƒX[ƒp[ƒNƒ‰ƒX‚‚‚Žg—p‚‚‚‚B #============================================================================== class Game_Character #-------------------------------------------------------------------------- # œ ‰– X •W‚Ž“ #-------------------------------------------------------------------------- def screen_x # Ž•W‚ƒ}ƒbƒv‚•\Žˆ’u‚‚‰–ʍ•W‚‹‚‚ return ((@ real_x - $game_map . display_x ) / 4 ). ceil + 16 end #-------------------------------------------------------------------------- # œ ‰– Y •W‚Ž“ #-------------------------------------------------------------------------- def screen_y # Ž•W‚ƒ}ƒbƒv‚•\Žˆ’u‚‚‰–ʍ•W‚‹‚‚ y = ((@ real_y - $game_map . display_y ) / 4 ). ceil + 32 # ƒWƒƒƒ“ƒvƒJƒEƒ“ƒg‚‰ž‚‚ Y •W‚‚‚•‚‚ 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 #-------------------------------------------------------------------------- # œ ƒtƒŒ[ƒ€XV (ˆ“) #-------------------------------------------------------------------------- def update_move # ˆ“‘“x‚‚ƒ}ƒbƒv•WŒn‚‚ˆ“‹——‚•Š distance = 2 ** @ move_speed if @ x * 128 != @ real_x and @ y * 128 != @ real_y and Game_Player :: SLANT distance /= Math . sqrt ( 2 ) end # ˜_—•W‚Ž•W‚‚‰‚̏‡ if @ y * 128 > @ real_y # ‰‚ˆ“ @ real_y = [@ real_y + distance , @ y * 128 ]. min end # ˜_—•W‚Ž•W‚‚荶‚̏‡ if @ x * 128 < @ real_x # ‚ˆ“ @ real_x = [@ real_x - distance , @ x * 128 ]. max end # ˜_—•W‚Ž•W‚‚‰E‚̏‡ if @ x * 128 > @ real_x # ‰E‚ˆ“ @ real_x = [@ real_x + distance , @ x * 128 ]. min end # ˜_—•W‚Ž•W‚‚‚̏‡ if @ y * 128 < @ real_y # ‚ˆ“ @ real_y = [@ real_y - distance , @ y * 128 ]. max end # ˆ“ŽžƒAƒjƒ‚ ON ‚̏‡ if @ walk_anime # ƒAƒjƒƒJƒEƒ“ƒg‚ 1.5 ‘‚‚ @ anime_count += 1.5 # ˆ“ŽžƒAƒjƒ‚ OFF ‚ŁA’Ž~ŽžƒAƒjƒ‚ ON ‚̏‡ elsif @ step_anime # ƒAƒjƒƒJƒEƒ“ƒg‚ 1 ‘‚‚ @ anime_count += 1 end end end #============================================================================== # Game_Event #------------------------------------------------------------------------------ # @ƒCƒxƒ“ƒg‚ˆ‚ƒNƒ‰ƒX‚‚BŒ”’‚‚‚ƒCƒxƒ“ƒgƒy[ƒW‚‘‚‚A•—ˆ— # ƒCƒxƒ“ƒgŽs‚‚‚‹@”\‚Ž‚‚‚‚AGame_Map ƒNƒ‰ƒX‚“•”‚Žg—p‚‚‚‚B #============================================================================== class Game_Event < Game_Character #-------------------------------------------------------------------------- # œ ƒCƒxƒ“ƒg‹N“ #-------------------------------------------------------------------------- def start # Žs“—e‚‹‚‚‚‡ if @list. size > 1 # $game_player.event ‚0‚‚‚‡ if $game_player . event != 0 # ˆ“‘“x‚ $game_player.event ‚‚‚ $game_player . move_speed = $game_player . event elsif self . trigger == 0 $game_player . move_speed = $game_player . walk end @ starting = true end end end