![]() |
|
RGSS-Scripts Postet hier die Scripts die ihr im Script-Editor selbst erstellt oder gefunden habt. Gefundene Scripts jedoch mit Quellenangabe posten! |
![]() |
|
Themen-Optionen |
![]() |
#1 |
Schwertfechter
![]() Registriert seit: 23.02.2006
Alter: 24
Beiträge: 299
|
![]() So, der Ultima schreibt auch mal was ins
RGSS Forum XD Ich habe diesen Skript gefunden der es ermöglicht anstatt die typischen "Felder Schritte" zu laufen eine 1/4 Schritt zu machen. Ich weiß echt nicht wie ich das anders erklären soll XD Man braucht also einfach 4 Schritte mit dem Skript um einen ganzen normalen Schritt wie es im Standart ist auszuführen. (Eigentlich sollte dieser Skript ein Jump&Run Engine Skript sein, aber ich habe keine ähnlichkeit mit´m Jump&Run gefunden ![]() #================================================= == # ▼ Jump and Run Configuration Begins #================================================= == UP = 32 # Legt fest wie weit der Charakter das obere Tileset berühren darf. DOWN = 0 # Legt fest wie weit der Charakter das untere Tileset set berühren darf. SIDE = 0 # Legt fest wie weit der Charakter das rechte beziehungsweise linke Tileset set berühren darf. JUMP_X = 34 # Legt die maximal Sprunhöhe fest (Achtung: Nicht die Pixel, sondern die Codewiederholung wird gezählt). JARS_MAPS = [17, 18] # Karten-ID auf der das Skript aktiviert wird. JUMP_PIXEL_ADD = 2 # Legt die Einheit der addierten Sprungpixel fest. CHARA_MAXSPEED = 28 # Legt die maximale Geschwindigkeit des Charakters fest, die er erreichen kann. CHARA_LONGJUMP = 22 # Legt die Geschwindigkeit fest, die erreicht werden muss, damit der Charakter einen längeren Sprung vollzieht. CHARA_OLD_SPEED = 16 # Legt die Anfangsgeschwingkeit des Charakters fest, wenn er stehen bleibt. CHARA_ACCELERATION = 0.35 # Legt die Beschleunigung des Charakters fest. FASTJUMP_PIXEL_ADD = 1.75 # Legt die Einheit der addierten Sprungpixel für höhere Geschwingkeit fest. CHARA_JUMP_SPEED_ADD = 5 # Legt einen Wert fest, wo für den Sprung Geschwingkeit extra addiert wird. CHARA_BRAKE_ACCELERATION = 0.5 # Legt die Bremsbeschleunigung fest. CHARA_TURN_BRAKE_ACCELERATION = 2 # Legt die Bremsbeschleunigung für eine plötzliche Umdrehung fest. #================================================= == # ▲ Jump and Run Configuration Ends #================================================= == #================================================= == # ▼ Jump and Run Engine (Part 1) Begins #================================================= == class Game_Jars def load @chara_jumped = false @chara_jump = false @chara_fallen = false @chara_turn = false @chara_move = false @chara_temp_direction = false @chara_acceleration = false @se_jump = false @jump_y = 0 @chara_direction_turn = 0 @chara_direction_move = 0 @chara_speed = CHARA_OLD_SPEED @chara_direction_save = 0 @chara_direction_load = 0 @chara_speed_add = 0 @chara_direction = 6 @character_save_name = @character_name @fall_sub = 0 end end #================================================= == # ▲ Jump and Run Engine (Part 1) Ends #================================================= == #================================================= == # ▲ Game_Temp Ends #================================================= == #================================================= == # ▼ Game_Player (Part 1) Begins #================================================= == class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Invariables #-------------------------------------------------------------------------- CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4 CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4 #-------------------------------------------------------------------------- # * Passable Determinants # x : x-coordinate # y : y-coordinate # d : direction (0,2,4,6,8) # * 0 = Determines if all directions are impassable (for jumping) #-------------------------------------------------------------------------- def passable?(x, y, d) # Get new coordinates new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0) # If coordinates are outside of map unless $game_map.valid?(new_x, new_y) # Impassable return false end # If debug mode is ON and ctrl key was pressed if $DEBUG and Input.press?(Input::CTRL) # Passable return true end super end #-------------------------------------------------------------------------- # * Set Map Display Position to Center of Screen #-------------------------------------------------------------------------- def center(x, y) max_x = ($game_map.width - 20) * 128 max_y = ($game_map.height - 15) * 128 $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max end #-------------------------------------------------------------------------- # * Move to Designated Position # x : x-coordinate # y : y-coordinate #-------------------------------------------------------------------------- def moveto(x, y) super # Centering center(x, y) # Make encounter count make_encounter_count end #-------------------------------------------------------------------------- # * Increaase Steps #-------------------------------------------------------------------------- def increase_steps super # If move route is not forcing unless @move_route_forcing # Increase steps $game_party.increase_steps # Number of steps are an even number if $game_party.steps % 2 == 0 # Slip damage check $game_party.check_map_slip_damage end end end #-------------------------------------------------------------------------- # * Get Encounter Count #-------------------------------------------------------------------------- def encounter_count return @encounter_count end #-------------------------------------------------------------------------- # * Make Encounter Count #-------------------------------------------------------------------------- def make_encounter_count # Image of two dice rolling if $game_map.map_id != 0 n = $game_map.encounter_step @encounter_count = rand(n) + rand(n) + 1 end end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # If party members = 0 if $game_party.actors.size == 0 # Clear character file name and hue @character_name = "" @character_hue = 0 # End method return end # Get lead actor actor = $game_party.actors[0] # Set character file name and hue @character_name = actor.character_name @character_hue = actor.character_hue # Initialize opacity level and blending method @opacity = 255 @blend_type = 0 end #-------------------------------------------------------------------------- # * Same Position Starting Determinant #-------------------------------------------------------------------------- def check_event_trigger_here(triggers) result = false # If event is running if $game_system.map_interpreter.running? return result end # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == @x and event.y == @y and triggers.include?(event.trigger) # If starting determinant is same position event (other than jumping) if not event.jumping? and event.over_trigger? event.start result = true end end end return result end #-------------------------------------------------------------------------- # * Front Envent Starting Determinant #-------------------------------------------------------------------------- def check_event_trigger_there(triggers) result = false # If event is running if $game_system.map_interpreter.running? return result end # Calculate front event coordinates new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == new_x and event.y == new_y and triggers.include?(event.trigger) # If starting determinant is front event (other than jumping) if not event.jumping? and not event.over_trigger? event.start result = true end end end # If fitting event is not found if result == false # If front tile is a counter if $game_map.counter?(new_x, new_y) # Calculate 1 tile inside coordinates new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == new_x and event.y == new_y and triggers.include?(event.trigger) # If starting determinant is front event (other than jumping) if not event.jumping? and not event.over_trigger? event.start result = true end end end end end return result end #-------------------------------------------------------------------------- # * Touch Event Starting Determinant #-------------------------------------------------------------------------- def check_event_trigger_touch(x, y) result = false # If event is running if $game_system.map_interpreter.running? return result end # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == x and event.y == y and [1,2].include?(event.trigger) # If starting determinant is front event (other than jumping) if not event.jumping? and not event.over_trigger? event.start result = true end end end return result end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Remember whether or not moving in local variables last_moving = moving? # If moving, event running, move route forcing, and message window # display are all not occurring unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing # Move player in the direction the directional button is being pressed case Input.dir4 when 2 move_down when 4 move_left when 6 move_right when 8 move_up end end # Remember coordinates in local variables last_real_x = @real_x last_real_y = @real_y super # If character moves down and is positioned lower than the center # of the screen if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y # Scroll map down $game_map.scroll_down(@real_y - last_real_y) end # If character moves left and is positioned more let on-screen than # center if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X # Scroll map left $game_map.scroll_left(last_real_x - @real_x) end # If character moves right and is positioned more right on-screen than # center if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X # Scroll map right $game_map.scroll_right(@real_x - last_real_x) end # If character moves up and is positioned higher than the center # of the screen if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y # Scroll map up $game_map.scroll_up(last_real_y - @real_y) end # If not moving unless moving? # If player was moving last time if last_moving # Event determinant is via touch of same position event result = check_event_trigger_here([1,2]) # If event which started does not exist if result == false # Disregard if debug mode is ON and ctrl key was pressed unless $DEBUG and Input.press?(Input::CTRL) # Encounter countdown if @encounter_count > 0 @encounter_count -= 1 end end end end # If C button was pressed if Input.trigger?(Input::C) # Same position and front event determinant check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) end end end end #================================================= == # ▲ Game_Player (Part 1) Ends #================================================= == #================================================= == # ▼ Game_Player (Part 2) Begins #================================================= == class Game_Player < Game_Character #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- SLANT = false #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- attr_reader :event attr_accessor :move_speed #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- alias :update_original :update def update @walk =+0 @event =+0 @dot_m = true 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 last_moving = moving? last_real_x = @real_x last_real_y = @real_y 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 = 2 ** @move_speed distance2 = Math.sqrt(@revise_x ** 2 + @revise_y ** 2) if distance1 > distance2 @real_x = @real_x - @revise_x @real_y = @real_y - @revise_y @revise_x = 0 @revise_y = 0 anime_update else @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 unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing @event_run = false #================================================= == # ▼ Jump and Run Engine (Part 2) Begins #================================================= == if JARS_MAPS.include?($game_map.map_id) @fall_sub = 0 if @chara_temp_direction == false @chara_direction_move = @direction @chara_temp_direction = true end @always_on_top = false $game_player.refresh if $DEBUG and Input.press?(Input::CTRL) @always_on_top = true $game_player.refresh end unless passable?(x,y--1,0) @chara_jump = true else @chara_jump = false end if @chara_jump == true if Input.trigger?(Input::C) unless $DEBUG and Input.press?(Input::CTRL) if @se_jump == false Audio.se_play("Audio/SE/jumpsnd") @se_jump = true end if @chara_speed <= CHARA_OLD_SPEED + 3 @chara_speed = CHARA_OLD_SPEED end @chara_move = false @chara_jumped = true @chara_jump = false @chara_fallen = true end end end if @chara_jumped == true if @jump_y <= JUMP_X unless $DEBUG and Input.press?(Input::CTRL) if @chara_speed <= CHARA_LONGJUMP move_up_p move_up_p @jump_folder = 0 @jump_y += JUMP_PIXEL_ADD else @chara_speed_add = CHARA_JUMP_SPEED_ADD move_up_p @jump_folder = 1 @jump_y += FASTJUMP_PIXEL_ADD end end end unless passable?(x,y-1,0) @jump_y = JUMP_X + 1 end end if not Input.press?(Input::C) if @jump_y >= JUMP_X / 2 @jump_y = JUMP_X + 1 end end if @jump_y >= JUMP_X @se_jump = false @chara_jumped = false @chara_jump = false @jump_y = 0 @chara_speed_add = 0 @chara_fallen = true end if @chara_jumped == false @chara_fallen = true if @chara_fallen == true @chara_jump = false @chara_speed_add = 0 if passable?(@x, @y, 2) if @jump_folder == 0 @fall_sub = @chara_speed * JUMP_PIXEL_ADD / 10 else @fall_sub = @chara_speed * FASTJUMP_PIXEL_ADD / 10 end else @fall_sub = 0 end unless $DEBUG and Input.press?(Input::CTRL) move_down_p move_down_p move_down_p end end end end case Input.dir4 when 2 unless JARS_MAPS.include?($game_map.map_id) move_down_p else @chara_speed = CHARA_OLD_SPEED / 2 end if JARS_MAPS.include?($game_map.map_id) if $DEBUG and Input.press?(Input::CTRL) move_down_p @chara_speed += CHARA_ACCELERATION end end when 4 unless $DEBUG and Input.press?(Input::CTRL) if JARS_MAPS.include?($game_map.map_id) if @chara_pixel_move == true if @chara_direction_move == 4 move_left_p else if @chara_speed > CHARA_OLD_SPEED / 2 +1 @chara_acceleration = true @chara_speed -= CHARA_TURN_BRAKE_ACCELERATION move_right_p else @chara_acceleration = false @chara_direction_move = 4 move_left_p end end end else move_left_p end else move_left_p end if JARS_MAPS.include?($game_map.map_id) if @chara_speed > CHARA_OLD_SPEED + 3 @chara_move = true end @direction = 4 @chara_direction = 4 @chara_direction_turn = 4 if @chara_acceleration == false @chara_speed += CHARA_ACCELERATION end end when 6 unless $DEBUG and Input.press?(Input::CTRL) if JARS_MAPS.include?($game_map.map_id) if @chara_pixel_move == true if @chara_direction_move == 6 move_right_p else if @chara_speed > CHARA_OLD_SPEED / 2 +1 @chara_acceleration = true @chara_speed -= CHARA_TURN_BRAKE_ACCELERATION move_left_p else @chara_acceleration = false @chara_direction_move = 6 move_right_p end end end else move_right_p end else move_right_p end if JARS_MAPS.include?($game_map.map_id) if @chara_speed > CHARA_OLD_SPEED + 3 @chara_move = true end @direction = 6 @chara_direction = 6 @chara_direction_turn = 6 if @chara_acceleration == false @chara_speed += CHARA_ACCELERATION end end when 8 unless JARS_MAPS.include?($game_map.map_id) move_up_p else @chara_speed = CHARA_OLD_SPEED / 2 end if JARS_MAPS.include?($game_map.map_id) if $DEBUG and Input.press?(Input::CTRL) move_up_p @chara_speed += CHARA_ACCELERATION end end else if JARS_MAPS.include?($game_map.map_id) @chara_acceleration = false if @chara_move == true if not passable?(@x, @y, 4) or not passable?(@x, @y, 6) if @chara_jumped == true @chara_speed = CHARA_OLD_SPEED / 2 end @chara_move = false end if @chara_speed > CHARA_OLD_SPEED / 2 @chara_speed -= CHARA_BRAKE_ACCELERATION if @chara_direction_turn == 4 move_left_p end if @chara_direction_turn == 6 move_right_p end end if @chara_speed <= CHARA_OLD_SPEED / 2 @chara_move = false end if $DEBUG and Input.press?(Input::CTRL) @chara_speed = CHARA_OLD_SPEED / 2 end else if @chara_jumped == false @chara_speed = CHARA_OLD_SPEED / 2 end end end end if JARS_MAPS.include?($game_map.map_id) if direction == 4 @chara_direction_save = 1 if @chara_direction_save != @chara_direction_load @jump_y = JUMP_X + 1 @chara_direction_load = 1 end end if direction == 6 @chara_direction_save = 0 if @chara_direction_save != @chara_direction_load @jump_y = JUMP_X + 1 @chara_direction_load = 0 end end if @chara_direction == 4 @direction = 4 end if @chara_direction == 6 @direction = 6 end unless $DEBUG and Input.press?(Input::CTRL) if @chara_speed >= CHARA_MAXSPEED @chara_speed = CHARA_MAXSPEED end else if @chara_speed >= 100000 @chara_speed = 100000 end end @chara_pixel_move = true end unless JARS_MAPS.include?($game_map.map_id) @chara_jumped = false @chara_jump = false @chara_fallen = false @chara_turn = false @chara_move = false @chara_temp_direction = false @chara_acceleration = false @se_jump = false @jump_y = 0 @chara_direction_turn = 0 @chara_direction_move = 0 @chara_speed = CHARA_OLD_SPEED @chara_direction_save = 0 @chara_direction_load = 0 @chara_speed_add = 0 @chara_direction = 6 @character_save_name = @character_name @fall_sub = 0 end #================================================= == # ▲ Jump and Run Engine (Part 2) Ends #================================================= == end last_real_x = @real_x last_real_y = @real_y @real_x = @x * 128 + @revise_x @real_y = @y * 128 + @revise_y last_moving = moving? move_on 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 anime_update else @pattern = 0 end end if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y $game_map.scroll_down(@real_y - last_real_y) end if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X $game_map.scroll_left(last_real_x - @real_x) end if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X $game_map.scroll_right(@real_x - last_real_x) end if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y $game_map.scroll_up(last_real_y - @real_y) end if last_moving result = check_event_trigger_here([1,2]) if result == false unless $DEBUG and Input.press?(Input::CTRL) if @encounter_count > 0 @encounter_count -= 1 end end end end if Input.trigger?(Input::C) check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def initialize @revise_x = 0 @revise_y = 0 @move == false super end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def moving? unless @dot_m result = super return result end if @move_route_forcing if @move == false return false end super 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def update_jump @jump_count -= 1 @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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_type_custom unless @dot_m super return end if jumping? or moving_a? return end while @move_route_index < @move_route.list.size command = @move_route.list[@move_route_index] if command.code == 0 if @move_route.repeat @move_route_index = 0 end unless @move_route.repeat if @move_route_forcing and not @move_route.repeat @move_route_forcing = false @move_route = @original_move_route @move_route_index = @original_move_route_index @original_move_route = nil end @stop_count = 0 end return end if command.code <= 14 case command.code when 1 move_down when 2 move_left when 3 move_right when 4 move_up when 5 move_lower_left when 6 move_lower_right when 7 move_upper_left when 8 move_upper_right when 9 move_random when 10 move_toward_player when 11 move_away_from_player when 12 move_forward when 13 move_backward when 14 jump(command.parameters[0], command.parameters[1]) end if not @move_route.skippable and not moving? and not jumping? return end @move_route_index += 1 return end if command.code == 15 @wait_count = command.parameters[0] * 2 - 1 @move_route_index += 1 return end if command.code >= 16 and command.code <= 26 case command.code when 16 turn_down when 17 turn_left when 18 turn_right when 19 turn_up when 20 turn_right_90 when 21 turn_left_90 when 22 turn_180 when 23 turn_right_or_left_90 when 24 turn_random when 25 turn_toward_player when 26 turn_away_from_player end @move_route_index += 1 return end if command.code >= 27 case command.code when 27 $game_switches[command.parameters[0]] = true $game_map.need_refresh = true when 28 $game_switches[command.parameters[0]] = false $game_map.need_refresh = true when 29 @move_speed = command.parameters[0] when 30 @move_frequency = command.parameters[0] when 31 @walk_anime = true when 32 @walk_anime = false when 33 @step_anime = true when 34 @step_anime = false when 35 @direction_fix = true when 36 @direction_fix = false when 37 @through = true when 38 @through = false when 39 @always_on_top = true when 40 @always_on_top = false when 41 @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 @opacity = command.parameters[0] when 43 @blend_type = command.parameters[0] when 44 $game_system.se_play(command.parameters[0]) when 45 result = eval(command.parameters[0]) end @move_route_index += 1 return end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_down_p turn_down distance = @chara_speed + @chara_speed_add - @fall_sub down1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def down2(x, y, distance, d = 2) if @revise_y + distance > DOWN unless passable?(x, y, d) if @revise_y < DOWN @revise_y = DOWN end return false end end return true end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_left_p turn_left distance = @chara_speed + @chara_speed_add - @fall_sub left1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 > DOWN @revise_y = DOWN end end return result end elsif @revise_y > DOWN 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_right_p turn_right distance = @chara_speed + @chara_speed_add - @fall_sub right1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 > DOWN @revise_y = DOWN end end return result end elsif @revise_y > DOWN 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 = @chara_speed + @chara_speed_add - @fall_sub up1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(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 > DOWN and -UP > @revise_y - distance @revise_y = DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_lower_right_p unless @direction_fix @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(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 > DOWN and -UP > @revise_y - distance @revise_y = DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_upper_left_p unless @direction_fix @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(2) 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 > DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_upper_right_p unless @direction_fix @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(2) 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 > DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def check_event_trigger_here(triggers, run = true) result = false if $game_system.map_interpreter.running? return result end for event in $game_map.events.values 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) 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def anime_update if @walk_anime @anime_count += 1.5 elsif @step_anime @anime_count += 1 end if @anime_count > 18 - @move_speed * 2 if not @step_anime and @stop_count > 0 @pattern = @original_pattern else @pattern = (@pattern + 1) % 4 end @anime_count = 0 end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- alias :moveto_original :moveto def moveto(x, y) @revise_x = 0 @revise_y = 0 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_Player (Part 2) Ends #================================================= == #================================================= == # ▼ Game_Character Begins #================================================= == class Game_Character #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def update_move distance = 2 ** @move_speed if @x * 128 != @real_x and @y * 128 != @real_y and Game_Player::SLANT distance /= Math.sqrt(2) end if @y * 128 > @real_y @real_y = [@real_y + distance, @y * 128].min end if @x * 128 < @real_x @real_x = [@real_x - distance, @x * 128].max end if @x * 128 > @real_x @real_x = [@real_x + distance, @x * 128].min end if @y * 128 < @real_y @real_y = [@real_y - distance, @y * 128].max end if @walk_anime @anime_count += 1.5 elsif @step_anime @anime_count += 1 end end end #================================================= == # ▲ Game_Character Ends #================================================= == #================================================= == # ▼ Game_Event Begins #================================================= == class Game_Event < Game_Character #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def start if @list.size > 1 if $game_player.event != 0 $game_player.move_speed = $game_player.event end @starting = true end end end #================================================= == # ▲ Game_Event Ends #================================================= == Ihr müsst den ganzen Skript mit dem gesamten Game_Player Skriptes eures Spieles eintauschen. Dann sollte es funktionieren XD mfg Ultima |
![]() |
![]() |
![]() |
#2 |
Abenteurer
![]() ![]() Registriert seit: 17.10.2004
Ort: Groß-Zimmern
Alter: 26
Beiträge: 545
|
![]() Das ist selbstversständlich ein Jump and Run Script verwende den nähmlich auch, nur bei dir fehlt ein bischen.
Hier das komplette ding: #================================================= ============================= # ** Jump and Run Engine #------------------------------------------------------------------------------ # Author: Kenai (Bear Games) # Version: 3.05.02c # Date: datum(1164194184) # Source: / http://forum.rpgxp.de/scriptia/data.php?content_id=14 #================================================= ============================= #================================================= ============================= # ** Game_Player #------------------------------------------------------------------------------ # This class handles the player. Its functions include event starting # determinants and map scrolling. Refer to "$game_player" for the one # instance of this class. #================================================= ============================= #================================================= ============================= # Script: Jump and Run Engine by Kenai (Bear Games) # Scriptname: Jump and Run Engine # Scriptversion: 3.05.02b (11.11.2006) #------------------------------------------------------------------------------ # Script -> Line: 0001-1460 # Jump and Run Configuration -> Line: 0069-0088 # Jump and Run Engine (Part 1) -> Line: 0090-0117 # Jump and Run Engine (Part 2) -> Line: 0458-0734 #------------------------------------------------------------------------------ # Homepage: http://www.bg-arena.de.vu/ <-|-> http://www.bear-games.de.vu/ # # Forum: http://www.bg-portal.de.vu/ <-|-> http://www.bg-forum.de.vu/ # # E-Mail: [email protected] # # Download: http://www.rpgxp.de/ # # Copyrights : -> © markusmks - edited (Pixelmovementscript) # -> © http://members.jcom.home.ne.jp/cogwheel/ - produced (Pixelmovementscript) # -> © Kenai - produced (Jump and Run Engine) #------------------------------------------------------------------------------ # So, genug Copyrights, zuerst möchte ich mich für das Pixelgenaugehen-Skript # mit acht Richtungen bedanken, ohne dieses tolle Skript hätte ich die Engine # niemals so hingekriegt. # # Ich habe das Skript so geschrieben, dass diverse Modifikationen vorgenommen # werden können. Alle Konifgurationen wirken sich unterschiedlich aus, also # muss anfangs etwas experimentiert werden, außerdem befindet sich eine sehr # knapp gehaltene Erklärung neben den zu einstellenden Werten. # # Die Konfiguration muss nicht zwingend geändert werden, zumindest wer ein # Mario-Spiel erstellen will, denn ich habe mir die Mühe gemacht die Ein- # stellungen an das Spiel “Super Mario World” anzupassen, also kann jeder # gleich mit seinem Projekt anfangen. Andere, die ein Sonicspiel oder ein # Metroidspiel erstellen wollen, müssen sich die Arbeit machen, die Werte # anzupassen. # # Normalerweise werden bei einem Kartenwechsel die Werte des Skripts nicht # zurückgesetzt, also muss dies manuell geschehen, aber auch nur wenn die Level # unabhängig von einander sind, das bedeutet es muss nicht bei jedem Karten- # wechsel oder Kartenteleport geschehen. Für das manuelle Reset muss ein Skript- # aufruf genutzt werden. Dort muss folgendes eingegeben werden: # # $jars_load = Game_Jars.new; $jars_load.load # # Dann werden die Werte zurückgesetzt, mehr muss nicht geschehen. Es muss # beachtet werden, wenn der Charakter eine Karte besucht, wo kein Jump and Run # aktiviert ist, werden die Werte so oder so zurückgesetzt. # # Wie die Karte für Jump and Rund aktiviert wird, steht bei den Konfigurationen, # die genaue Zeile oder Line steht oben. # # Ich möchte dir nicht viel auferlegen, außer, wenn du dieses Skript überhaupt # nutzt, einen Creditseintrag mit "Kenai / Bear Games". # # Für eventuelle Fragen, könnt ihr mir eine Mail schicken, die Adresse steht # oben, also bis dahin und viel Spass mit dem Skript. #================================================= ============================= #================================================= == # ▼ Jump and Run Configuration Begins #================================================= == UP = 32 # Legt fest wie weit der Charakter das obere Tileset berühren darf. DOWN = 0 # Legt fest wie weit der Charakter das untere Tileset set berühren darf. SIDE = 0 # Legt fest wie weit der Charakter das rechte beziehungsweise linke Tileset set berühren darf. JUMP_X = 34 # Legt die maximal Sprunhöhe fest (Achtung: Nicht die Pixel, sondern die Codewiederholung wird gezählt). JARS_MAPS = [2, 17, 18] # Karten-ID auf der das Skript aktiviert wird. JUMP_PIXEL_ADD = 2 # Legt die Einheit der addierten Sprungpixel fest. CHARA_MAXSPEED = 28 # Legt die maximale Geschwindigkeit des Charakters fest, die er erreichen kann. CHARA_LONGJUMP = 22 # Legt die Geschwindigkeit fest, die erreicht werden muss, damit der Charakter einen längeren Sprung vollzieht. CHARA_OLD_SPEED = 16 # Legt die Anfangsgeschwingkeit des Charakters fest, wenn er stehen bleibt. CHARA_ACCELERATION = 0.35 # Legt die Beschleunigung des Charakters fest. FASTJUMP_PIXEL_ADD = 1.75 # Legt die Einheit der addierten Sprungpixel für höhere Geschwingkeit fest. CHARA_JUMP_SPEED_ADD = 5 # Legt einen Wert fest, wo für den Sprung Geschwingkeit extra addiert wird. CHARA_BRAKE_ACCELERATION = 0.5 # Legt die Bremsbeschleunigung fest. CHARA_TURN_BRAKE_ACCELERATION = 2 # Legt die Bremsbeschleunigung für eine plötzliche Umdrehung fest. #================================================= == # ▲ Jump and Run Configuration Ends #================================================= == #================================================= == # ▼ Jump and Run Engine (Part 1) Begins #================================================= == class Game_Jars def load @chara_jumped = false @chara_jump = false @chara_fallen = false @chara_turn = false @chara_move = false @chara_temp_direction = false @chara_acceleration = false @se_jump = false @jump_y = 0 @chara_direction_turn = 0 @chara_direction_move = 0 @chara_speed = CHARA_OLD_SPEED @chara_direction_save = 0 @chara_direction_load = 0 @chara_speed_add = 0 @chara_direction = 6 @character_save_name = @character_name @fall_sub = 0 end end #================================================= == # ▲ Jump and Run Engine (Part 1) Ends #================================================= == #================================================= == # ▲ Game_Temp Ends #================================================= == #================================================= == # ▼ Game_Player (Part 1) Begins #================================================= == class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Invariables #-------------------------------------------------------------------------- CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4 CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4 #-------------------------------------------------------------------------- # * Passable Determinants # x : x-coordinate # y : y-coordinate # d : direction (0,2,4,6,8) # * 0 = Determines if all directions are impassable (for jumping) #-------------------------------------------------------------------------- def passable?(x, y, d) # Get new coordinates new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0) # If coordinates are outside of map unless $game_map.valid?(new_x, new_y) # Impassable return false end # If debug mode is ON and ctrl key was pressed if $DEBUG and Input.press?(Input::CTRL) # Passable return true end super end #-------------------------------------------------------------------------- # * Set Map Display Position to Center of Screen #-------------------------------------------------------------------------- def center(x, y) max_x = ($game_map.width - 20) * 128 max_y = ($game_map.height - 15) * 128 $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max end #-------------------------------------------------------------------------- # * Move to Designated Position # x : x-coordinate # y : y-coordinate #-------------------------------------------------------------------------- def moveto(x, y) super # Centering center(x, y) # Make encounter count make_encounter_count end #-------------------------------------------------------------------------- # * Increaase Steps #-------------------------------------------------------------------------- def increase_steps super # If move route is not forcing unless @move_route_forcing # Increase steps $game_party.increase_steps # Number of steps are an even number if $game_party.steps % 2 == 0 # Slip damage check $game_party.check_map_slip_damage end end end #-------------------------------------------------------------------------- # * Get Encounter Count #-------------------------------------------------------------------------- def encounter_count return @encounter_count end #-------------------------------------------------------------------------- # * Make Encounter Count #-------------------------------------------------------------------------- def make_encounter_count # Image of two dice rolling if $game_map.map_id != 0 n = $game_map.encounter_step @encounter_count = rand(n) + rand(n) + 1 end end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # If party members = 0 if $game_party.actors.size == 0 # Clear character file name and hue @character_name = "" @character_hue = 0 # End method return end # Get lead actor actor = $game_party.actors[0] # Set character file name and hue @character_name = actor.character_name @character_hue = actor.character_hue # Initialize opacity level and blending method @opacity = 255 @blend_type = 0 end #-------------------------------------------------------------------------- # * Same Position Starting Determinant #-------------------------------------------------------------------------- def check_event_trigger_here(triggers) result = false # If event is running if $game_system.map_interpreter.running? return result end # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == @x and event.y == @y and triggers.include?(event.trigger) # If starting determinant is same position event (other than jumping) if not event.jumping? and event.over_trigger? event.start result = true end end end return result end #-------------------------------------------------------------------------- # * Front Envent Starting Determinant #-------------------------------------------------------------------------- def check_event_trigger_there(triggers) result = false # If event is running if $game_system.map_interpreter.running? return result end # Calculate front event coordinates new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == new_x and event.y == new_y and triggers.include?(event.trigger) # If starting determinant is front event (other than jumping) if not event.jumping? and not event.over_trigger? event.start result = true end end end # If fitting event is not found if result == false # If front tile is a counter if $game_map.counter?(new_x, new_y) # Calculate 1 tile inside coordinates new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == new_x and event.y == new_y and triggers.include?(event.trigger) # If starting determinant is front event (other than jumping) if not event.jumping? and not event.over_trigger? event.start result = true end end end end end return result end #-------------------------------------------------------------------------- # * Touch Event Starting Determinant #-------------------------------------------------------------------------- def check_event_trigger_touch(x, y) result = false # If event is running if $game_system.map_interpreter.running? return result end # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == x and event.y == y and [1,2].include?(event.trigger) # If starting determinant is front event (other than jumping) if not event.jumping? and not event.over_trigger? event.start result = true end end end return result end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Remember whether or not moving in local variables last_moving = moving? # If moving, event running, move route forcing, and message window # display are all not occurring unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing # Move player in the direction the directional button is being pressed case Input.dir4 when 2 move_down when 4 move_left when 6 move_right when 8 move_up end end # Remember coordinates in local variables last_real_x = @real_x last_real_y = @real_y super # If character moves down and is positioned lower than the center # of the screen if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y # Scroll map down $game_map.scroll_down(@real_y - last_real_y) end # If character moves left and is positioned more let on-screen than # center if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X # Scroll map left $game_map.scroll_left(last_real_x - @real_x) end # If character moves right and is positioned more right on-screen than # center if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X # Scroll map right $game_map.scroll_right(@real_x - last_real_x) end # If character moves up and is positioned higher than the center # of the screen if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y # Scroll map up $game_map.scroll_up(last_real_y - @real_y) end # If not moving unless moving? # If player was moving last time if last_moving # Event determinant is via touch of same position event result = check_event_trigger_here([1,2]) # If event which started does not exist if result == false # Disregard if debug mode is ON and ctrl key was pressed unless $DEBUG and Input.press?(Input::CTRL) # Encounter countdown if @encounter_count > 0 @encounter_count -= 1 end end end end # If C button was pressed if Input.trigger?(Input::C) # Same position and front event determinant check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) end end end end #================================================= == # ▲ Game_Player (Part 1) Ends #================================================= == #================================================= == # ▼ Game_Player (Part 2) Begins #================================================= == class Game_Player < Game_Character #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- SLANT = false #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- attr_reader :event attr_accessor :move_speed #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- alias :update_original :update def update @walk =+0 @event =+0 @dot_m = true 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 last_moving = moving? last_real_x = @real_x last_real_y = @real_y 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 = 2 ** @move_speed distance2 = Math.sqrt(@revise_x ** 2 + @revise_y ** 2) if distance1 > distance2 @real_x = @real_x - @revise_x @real_y = @real_y - @revise_y @revise_x = 0 @revise_y = 0 anime_update else @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 unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing @event_run = false #================================================= == # ▼ Jump and Run Engine (Part 2) Begins #================================================= == if JARS_MAPS.include?($game_map.map_id) @fall_sub = 0 if @chara_temp_direction == false @chara_direction_move = @direction @chara_temp_direction = true end @always_on_top = false $game_player.refresh if $DEBUG and Input.press?(Input::CTRL) @always_on_top = true $game_player.refresh end unless passable?(x,y--1,0) @chara_jump = true else @chara_jump = false end if @chara_jump == true if Input.trigger?(Input::C) unless $DEBUG and Input.press?(Input::CTRL) if @se_jump == false Audio.se_play("Audio/SE/jumpsnd") @se_jump = true end if @chara_speed <= CHARA_OLD_SPEED + 3 @chara_speed = CHARA_OLD_SPEED end @chara_move = false @chara_jumped = true @chara_jump = false @chara_fallen = true end end end if @chara_jumped == true if @jump_y <= JUMP_X unless $DEBUG and Input.press?(Input::CTRL) if @chara_speed <= CHARA_LONGJUMP move_up_p move_up_p @jump_folder = 0 @jump_y += JUMP_PIXEL_ADD else @chara_speed_add = CHARA_JUMP_SPEED_ADD move_up_p @jump_folder = 1 @jump_y += FASTJUMP_PIXEL_ADD end end end unless passable?(x,y-1,0) @jump_y = JUMP_X + 1 end end if not Input.press?(Input::C) if @jump_y >= JUMP_X / 2 @jump_y = JUMP_X + 1 end end if @jump_y >= JUMP_X @se_jump = false @chara_jumped = false @chara_jump = false @jump_y = 0 @chara_speed_add = 0 @chara_fallen = true end if @chara_jumped == false @chara_fallen = true if @chara_fallen == true @chara_jump = false @chara_speed_add = 0 if passable?(@x, @y, 2) if @jump_folder == 0 @fall_sub = @chara_speed * JUMP_PIXEL_ADD / 10 else @fall_sub = @chara_speed * FASTJUMP_PIXEL_ADD / 10 end else @fall_sub = 0 end unless $DEBUG and Input.press?(Input::CTRL) move_down_p move_down_p move_down_p end end end end case Input.dir4 when 2 unless JARS_MAPS.include?($game_map.map_id) move_down_p else @chara_speed = CHARA_OLD_SPEED / 2 end if JARS_MAPS.include?($game_map.map_id) if $DEBUG and Input.press?(Input::CTRL) move_down_p @chara_speed += CHARA_ACCELERATION end end when 4 unless $DEBUG and Input.press?(Input::CTRL) if JARS_MAPS.include?($game_map.map_id) if @chara_pixel_move == true if @chara_direction_move == 4 move_left_p else if @chara_speed > CHARA_OLD_SPEED / 2 +1 @chara_acceleration = true @chara_speed -= CHARA_TURN_BRAKE_ACCELERATION move_right_p else @chara_acceleration = false @chara_direction_move = 4 move_left_p end end end else move_left_p end else move_left_p end if JARS_MAPS.include?($game_map.map_id) if @chara_speed > CHARA_OLD_SPEED + 3 @chara_move = true end @direction = 4 @chara_direction = 4 @chara_direction_turn = 4 if @chara_acceleration == false @chara_speed += CHARA_ACCELERATION end end when 6 unless $DEBUG and Input.press?(Input::CTRL) if JARS_MAPS.include?($game_map.map_id) if @chara_pixel_move == true if @chara_direction_move == 6 move_right_p else if @chara_speed > CHARA_OLD_SPEED / 2 +1 @chara_acceleration = true @chara_speed -= CHARA_TURN_BRAKE_ACCELERATION move_left_p else @chara_acceleration = false @chara_direction_move = 6 move_right_p end end end else move_right_p end else move_right_p end if JARS_MAPS.include?($game_map.map_id) if @chara_speed > CHARA_OLD_SPEED + 3 @chara_move = true end @direction = 6 @chara_direction = 6 @chara_direction_turn = 6 if @chara_acceleration == false @chara_speed += CHARA_ACCELERATION end end when 8 unless JARS_MAPS.include?($game_map.map_id) move_up_p else @chara_speed = CHARA_OLD_SPEED / 2 end if JARS_MAPS.include?($game_map.map_id) if $DEBUG and Input.press?(Input::CTRL) move_up_p @chara_speed += CHARA_ACCELERATION end end else if JARS_MAPS.include?($game_map.map_id) @chara_acceleration = false if @chara_move == true if not passable?(@x, @y, 4) or not passable?(@x, @y, 6) if @chara_jumped == true @chara_speed = CHARA_OLD_SPEED / 2 end @chara_move = false end if @chara_speed > CHARA_OLD_SPEED / 2 @chara_speed -= CHARA_BRAKE_ACCELERATION if @chara_direction_turn == 4 move_left_p end if @chara_direction_turn == 6 move_right_p end end if @chara_speed <= CHARA_OLD_SPEED / 2 @chara_move = false end if $DEBUG and Input.press?(Input::CTRL) @chara_speed = CHARA_OLD_SPEED / 2 end else if @chara_jumped == false @chara_speed = CHARA_OLD_SPEED / 2 end end end end if JARS_MAPS.include?($game_map.map_id) if direction == 4 @chara_direction_save = 1 if @chara_direction_save != @chara_direction_load @jump_y = JUMP_X + 1 @chara_direction_load = 1 end end if direction == 6 @chara_direction_save = 0 if @chara_direction_save != @chara_direction_load @jump_y = JUMP_X + 1 @chara_direction_load = 0 end end if @chara_direction == 4 @direction = 4 end if @chara_direction == 6 @direction = 6 end unless $DEBUG and Input.press?(Input::CTRL) if @chara_speed >= CHARA_MAXSPEED @chara_speed = CHARA_MAXSPEED end else if @chara_speed >= 100000 @chara_speed = 100000 end end @chara_pixel_move = true end unless JARS_MAPS.include?($game_map.map_id) @chara_jumped = false @chara_jump = false @chara_fallen = false @chara_turn = false @chara_move = false @chara_temp_direction = false @chara_acceleration = false @se_jump = false @jump_y = 0 @chara_direction_turn = 0 @chara_direction_move = 0 @chara_speed = CHARA_OLD_SPEED @chara_direction_save = 0 @chara_direction_load = 0 @chara_speed_add = 0 @chara_direction = 6 @character_save_name = @character_name @fall_sub = 0 end #================================================= == # ▲ Jump and Run Engine (Part 2) Ends #================================================= == end last_real_x = @real_x last_real_y = @real_y @real_x = @x * 128 + @revise_x @real_y = @y * 128 + @revise_y last_moving = moving? move_on 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 anime_update else @pattern = 0 end end if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y $game_map.scroll_down(@real_y - last_real_y) end if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X $game_map.scroll_left(last_real_x - @real_x) end if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X $game_map.scroll_right(@real_x - last_real_x) end if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y $game_map.scroll_up(last_real_y - @real_y) end if last_moving result = check_event_trigger_here([1,2]) if result == false unless $DEBUG and Input.press?(Input::CTRL) if @encounter_count > 0 @encounter_count -= 1 end end end end if Input.trigger?(Input::C) check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def initialize @revise_x = 0 @revise_y = 0 @move == false super end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def moving? unless @dot_m result = super return result end if @move_route_forcing if @move == false return false end super 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def update_jump @jump_count -= 1 @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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_type_custom unless @dot_m super return end if jumping? or moving_a? return end while @move_route_index < @move_route.list.size command = @move_route.list[@move_route_index] if command.code == 0 if @move_route.repeat @move_route_index = 0 end unless @move_route.repeat if @move_route_forcing and not @move_route.repeat @move_route_forcing = false @move_route = @original_move_route @move_route_index = @original_move_route_index @original_move_route = nil end @stop_count = 0 end return end if command.code <= 14 case command.code when 1 move_down when 2 move_left when 3 move_right when 4 move_up when 5 move_lower_left when 6 move_lower_right when 7 move_upper_left when 8 move_upper_right when 9 move_random when 10 move_toward_player when 11 move_away_from_player when 12 move_forward when 13 move_backward when 14 jump(command.parameters[0], command.parameters[1]) end if not @move_route.skippable and not moving? and not jumping? return end @move_route_index += 1 return end if command.code == 15 @wait_count = command.parameters[0] * 2 - 1 @move_route_index += 1 return end if command.code >= 16 and command.code <= 26 case command.code when 16 turn_down when 17 turn_left when 18 turn_right when 19 turn_up when 20 turn_right_90 when 21 turn_left_90 when 22 turn_180 when 23 turn_right_or_left_90 when 24 turn_random when 25 turn_toward_player when 26 turn_away_from_player end @move_route_index += 1 return end if command.code >= 27 case command.code when 27 $game_switches[command.parameters[0]] = true $game_map.need_refresh = true when 28 $game_switches[command.parameters[0]] = false $game_map.need_refresh = true when 29 @move_speed = command.parameters[0] when 30 @move_frequency = command.parameters[0] when 31 @walk_anime = true when 32 @walk_anime = false when 33 @step_anime = true when 34 @step_anime = false when 35 @direction_fix = true when 36 @direction_fix = false when 37 @through = true when 38 @through = false when 39 @always_on_top = true when 40 @always_on_top = false when 41 @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 @opacity = command.parameters[0] when 43 @blend_type = command.parameters[0] when 44 $game_system.se_play(command.parameters[0]) when 45 result = eval(command.parameters[0]) end @move_route_index += 1 return end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_down_p turn_down distance = @chara_speed + @chara_speed_add - @fall_sub down1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def down2(x, y, distance, d = 2) if @revise_y + distance > DOWN unless passable?(x, y, d) if @revise_y < DOWN @revise_y = DOWN end return false end end return true end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_left_p turn_left distance = @chara_speed + @chara_speed_add - @fall_sub left1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 > DOWN @revise_y = DOWN end end return result end elsif @revise_y > DOWN 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_right_p turn_right distance = @chara_speed + @chara_speed_add - @fall_sub right1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 > DOWN @revise_y = DOWN end end return result end elsif @revise_y > DOWN 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 = @chara_speed + @chara_speed_add - @fall_sub up1(((@x * 128 + @revise_x) / 128.0).round, ((@y * 128 + @revise_y) / 128.0).round, distance, true) end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(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 > DOWN and -UP > @revise_y - distance @revise_y = DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_lower_right_p unless @direction_fix @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(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 > DOWN and -UP > @revise_y - distance @revise_y = DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_upper_left_p unless @direction_fix @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(2) 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 > DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def move_upper_right_p unless @direction_fix @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction) end distance = (2 ** @move_speed) / Math.sqrt(2) 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 > DOWN 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 end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def check_event_trigger_here(triggers, run = true) result = false if $game_system.map_interpreter.running? return result end for event in $game_map.events.values 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) 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def anime_update if @walk_anime @anime_count += 1.5 elsif @step_anime @anime_count += 1 end if @anime_count > 18 - @move_speed * 2 if not @step_anime and @stop_count > 0 @pattern = @original_pattern else @pattern = (@pattern + 1) % 4 end @anime_count = 0 end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- alias :moveto_original :moveto def moveto(x, y) @revise_x = 0 @revise_y = 0 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_Player (Part 2) Ends #================================================= == #================================================= == # ▼ Game_Character Begins #================================================= == class Game_Character #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def update_move distance = 2 ** @move_speed if @x * 128 != @real_x and @y * 128 != @real_y and Game_Player::SLANT distance /= Math.sqrt(2) end if @y * 128 > @real_y @real_y = [@real_y + distance, @y * 128].min end if @x * 128 < @real_x @real_x = [@real_x - distance, @x * 128].max end if @x * 128 > @real_x @real_x = [@real_x + distance, @x * 128].min end if @y * 128 < @real_y @real_y = [@real_y - distance, @y * 128].max end if @walk_anime @anime_count += 1.5 elsif @step_anime @anime_count += 1 end end end #================================================= == # ▲ Game_Character Ends #================================================= == #================================================= == # ▼ Game_Event Begins #================================================= == class Game_Event < Game_Character #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- def start if @list.size > 1 if $game_player.event != 0 $game_player.move_speed = $game_player.event end @starting = true end end end #================================================= == # ▲ Game_Event Ends #================================================= == |
![]() |
![]() |
![]() |
Lesezeichen |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
Themen-Optionen | |
|
|
![]() |
||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
Scibo Burask - Ein Kleiner Schritt | La pasión | Medien und Kunst | 3 | 08.07.2006 17:42 |