Advertisement
TechSkylander1518

Marin's Enhanced Stairs for v19

Sep 13th, 2021 (edited)
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 20.71 KB | None | 0 0
  1. #==============================================================================#
  2. #                             Enhanced Staircases                              #
  3. #                                  by Marin                                    #
  4. #------------------------------------------------------------------------------#
  5. # This script provides pixel movement while walking on staircases, while also  #
  6. # slowing down movement to capture the real feeling and motion of a staircase. #
  7. #------------------------------------------------------------------------------#
  8. #                                  Usage                                       #
  9. #                                                                              #
  10. # To make a stair work smoothly, it must have one event at the bottom, and one #
  11. # at the top (not on the staircase; one tile outwards).                        #
  12. # Staircase events utilize comments to configure the properties of the stairs. #
  13. # These comments are not compiled it any different format unlike, say, trainer #
  14. # generation, and as such do not require you to restart RPG Maker XP.          #
  15. #                                                                              #
  16. # The name of a staircase event must be `Slope` (without the backticks ``),    #
  17. # and the event must contain a comment with the following text:                #
  18. # `Slope: AxB` where A and B are integers, specifying how many tiles           #
  19. # away the second event is. If the staircase is wider than 1 tile, this must   #
  20. # match up with event that has the same stair index, as explained below.       #
  21. #                                                                              #
  22. # If your staircase is more than 1 tile wide, you require an additional        #
  23. # `Width: A/B` comment, where A is the index of the event in the staircase     #
  24. # (i.e. if it's the bottom part of the staircase 0, if it's one higher 1, etc) #
  25. # and B is the total width of the staircase. If you understand the explanation,#
  26. # you'll agree that this means that the top event of a 3-wide staircase will   #
  27. # say `Width: 2/3`.                                                            #
  28. #                                                                              #
  29. # It is also possible to specify at which point during movement from the event #
  30. # to the start of the staircase to increment the vertical offset.              #
  31. # By default, this is a value of 16 pixels. This means that you move without   #
  32. # any vertical increase for the first 16 pixels, and after that start climbing #
  33. # the staircase.                                                               #
  34. # To change this offset, write in a comment, `Offset: Apx`, where A is the     #
  35. # number of pixels after which to start climbing the staircase.                #
  36. #------------------------------------------------------------------------------#
  37. #                    Please give credit when using this.                       #
  38. #==============================================================================#
  39.  
  40. PluginManager.register({
  41.   :name => "Enhanced Staircases",
  42.   :version => "1.7",
  43.   :credits => "Marin",
  44.   :link => "https://reliccastle.com/resources/396/"
  45. })
  46.  
  47. # If true, overwrites default scrolling behaviour to make stair movement smooth
  48. # and to reduce improper scrolling offsets after walking on stairs wider than 1.
  49. SMOOTH_SCROLLING = true
  50.  
  51. $DisableScrollCounter = 0
  52.  
  53. class DependentEvents
  54.   def pbFollowEventAcrossMaps(leader,follower,instant=false,leaderIsTrueLeader=true)
  55.     d=leader.direction
  56.     areConnected=$MapFactory.areConnected?(leader.map.map_id,follower.map.map_id)
  57.     # Get the rear facing tile of leader
  58.     facingDirection=10-d
  59.     if !leaderIsTrueLeader && areConnected
  60.       relativePos=$MapFactory.getThisAndOtherEventRelativePos(leader,follower)
  61.       # Assumes leader and follower are both 1x1 tile in size
  62.       if (relativePos[1]==0 && relativePos[0]==2)   # 2 spaces to the right of leader
  63.         facingDirection=6
  64.       elsif (relativePos[1]==0 && relativePos[0]==-2)   # 2 spaces to the left of leader
  65.         facingDirection=4
  66.       elsif relativePos[1]==-2 && relativePos[0]==0   # 2 spaces above leader
  67.         facingDirection=8
  68.       elsif relativePos[1]==2 && relativePos[0]==0   # 2 spaces below leader
  69.         facingDirection=2
  70.       end
  71.     end
  72.     facings=[facingDirection] # Get facing from behind
  73. #    facings.push([0,0,4,0,8,0,2,0,6][d])   # Get right facing
  74. #    facings.push([0,0,6,0,2,0,8,0,4][d])   # Get left facing
  75.     if !leaderIsTrueLeader
  76.       facings.push(d) # Get forward facing
  77.     end
  78.     mapTile=nil
  79.     if areConnected
  80.       bestRelativePos=-1
  81.       oldthrough=follower.through
  82.       follower.through=false
  83.       for i in 0...facings.length
  84.         facing=facings[i]
  85.         tile=$MapFactory.getFacingTile(facing,leader)
  86.         # Assumes leader is 1x1 tile in size
  87.         passable=tile && $MapFactory.isPassableStrict?(tile[0],tile[1],tile[2],follower)
  88.         if i==0 && !passable && tile &&
  89.            $MapFactory.getTerrainTag(tile[0],tile[1],tile[2]).ledge
  90.           # If the tile isn't passable and the tile is a ledge,
  91.           # get tile from further behind
  92.           tile=$MapFactory.getFacingTileFromPos(tile[0],tile[1],tile[2],facing)
  93.           passable=tile && $MapFactory.isPassableStrict?(tile[0],tile[1],tile[2],follower)
  94.         end
  95.         if passable
  96.           relativePos=$MapFactory.getThisAndOtherPosRelativePos(
  97.              follower,tile[0],tile[1],tile[2])
  98.           # Assumes follower is 1x1 tile in size
  99.           distance=Math.sqrt(relativePos[0]*relativePos[0]+relativePos[1]*relativePos[1])
  100.           if bestRelativePos==-1 || bestRelativePos>distance
  101.             bestRelativePos=distance
  102.             mapTile=tile
  103.           end
  104.           if i==0 && distance<=1 # Prefer behind if tile can move up to 1 space
  105.             break
  106.           end
  107.         end
  108.       end
  109.       follower.through=oldthrough
  110.     else
  111.       tile=$MapFactory.getFacingTile(facings[0],leader)
  112.       # Assumes leader is 1x1 tile in size
  113.       passable=tile && $MapFactory.isPassableStrict?(tile[0],tile[1],tile[2],follower)
  114.       mapTile=passable ? mapTile : nil
  115.     end
  116.     if mapTile && follower.map.map_id==mapTile[0]
  117.       # Follower is on same map
  118.       newX=mapTile[1]
  119.       newY=mapTile[2]
  120.       if leader.on_stair?
  121.         newX = leader.x + (leader.direction == 4 ? 1 : leader.direction == 6 ? -1 : 0)
  122.         if leader.on_middle_of_stair?
  123.           newY = leader.y + (leader.direction == 8 ? 1 : leader.direction == 2 ? -1 : 0)
  124.         else
  125.           if follower.on_middle_of_stair?
  126.             newY = follower.stair_start_y - follower.stair_y_position
  127.           else
  128.             newY = leader.y + (leader.direction == 8 ? 1 : leader.direction == 2 ? -1 : 0)
  129.           end
  130.         end
  131.       end
  132.       deltaX=(d == 6 ? -1 : d == 4 ? 1 : 0)
  133.       deltaY=(d == 2 ? -1 : d == 8 ? 1 : 0)
  134.       posX = newX + deltaX
  135.       posY = newY + deltaY
  136.       follower.move_speed=leader.move_speed # sync movespeed
  137.       if (follower.x-newX==-1 && follower.y==newY) ||
  138.          (follower.x-newX==1 && follower.y==newY) ||
  139.          (follower.y-newY==-1 && follower.x==newX) ||
  140.          (follower.y-newY==1 && follower.x==newX)
  141.         if instant
  142.           follower.moveto(newX,newY)
  143.         else
  144.           pbFancyMoveTo(follower,newX,newY,leader)
  145.         end
  146.       elsif (follower.x-newX==-2 && follower.y==newY) ||
  147.             (follower.x-newX==2 && follower.y==newY) ||
  148.             (follower.y-newY==-2 && follower.x==newX) ||
  149.             (follower.y-newY==2 && follower.x==newX)
  150.         if instant
  151.           follower.moveto(newX,newY)
  152.         else
  153.           pbFancyMoveTo(follower,newX,newY,leader)
  154.         end
  155.       elsif follower.x!=posX || follower.y!=posY
  156.         if instant
  157.           follower.moveto(newX,newY)
  158.         else
  159.           pbFancyMoveTo(follower,posX,posY,leader)
  160.           pbFancyMoveTo(follower,newX,newY,leader)
  161.         end
  162.       end
  163.     else
  164.       if !mapTile
  165.         # Make current position into leader's position
  166.         mapTile=[leader.map.map_id,leader.x,leader.y]
  167.       end
  168.       if follower.map.map_id==mapTile[0]
  169.         # Follower is on same map as leader
  170.         follower.moveto(leader.x,leader.y)
  171.       else
  172.         # Follower will move to different map
  173.         events=$PokemonGlobal.dependentEvents
  174.         eventIndex=pbEnsureEvent(follower,mapTile[0])
  175.         if eventIndex>=0
  176.           newFollower=@realEvents[eventIndex]
  177.           newEventData=events[eventIndex]
  178.           newFollower.moveto(mapTile[1],mapTile[2])
  179.           newEventData[3]=mapTile[1]
  180.           newEventData[4]=mapTile[2]
  181.         end
  182.       end
  183.     end
  184.   end
  185. end
  186.  
  187. def pbTurnTowardEvent(event,otherEvent)
  188.   sx = 0; sy = 0
  189.   if $MapFactory
  190.     relativePos=$MapFactory.getThisAndOtherEventRelativePos(otherEvent,event)
  191.     sx = relativePos[0]
  192.     sy = relativePos[1]
  193.   else
  194.     sx = event.x - otherEvent.x
  195.     sy = event.y - otherEvent.y
  196.   end
  197.   return if sx == 0 and sy == 0
  198.   if event.on_middle_of_stair? && !otherEvent.on_middle_of_stair?
  199.     sx > 0 ? event.turn_left : event.turn_right
  200.     return
  201.   end
  202.   if sx.abs > sy.abs
  203.     (sx > 0) ? event.turn_left : event.turn_right
  204.   else
  205.     (sy > 0) ? event.turn_up : event.turn_down
  206.   end
  207. end
  208.  
  209. class Scene_Map
  210.   alias stair_transfer_player transfer_player
  211.   def transfer_player(cancelVehicles = true)
  212.     stair_transfer_player(cancelVehicles)
  213.     $game_player.clear_stair_data
  214.   end
  215. end
  216.  
  217. class Game_Event
  218.   alias stair_cett check_event_trigger_touch
  219.   def check_event_trigger_touch(dir)
  220.     return if on_stair?
  221.     return stair_cett(dir)
  222.   end
  223.  
  224.   alias stair_ceta check_event_trigger_auto
  225.   def check_event_trigger_auto
  226.     if $game_map && $game_map.events
  227.       for event in $game_map.events.values
  228.         next if self.is_stair_event? || @id == event.id
  229.         if @real_x / Game_Map::REAL_RES_X == event.x &&
  230.            @real_y / Game_Map::REAL_RES_Y == event.y
  231.           if event.is_stair_event?
  232.             self.slope(*event.get_stair_data)
  233.             return
  234.           end
  235.         end
  236.       end
  237.     end
  238.     return if on_stair? || $game_player.on_stair?
  239.     return stair_ceta
  240.   end
  241.  
  242.   alias stair_start start
  243.   def start
  244.     if is_stair_event?
  245.       $game_player.slope(*self.get_stair_data)
  246.     else
  247.       stair_start
  248.     end
  249.   end
  250.  
  251.   def is_stair_event?
  252.     return self.name == "Slope"
  253.   end
  254.  
  255.   def get_stair_data
  256.     return if !is_stair_event?
  257.     return if !@list
  258.     for cmd in @list
  259.       if cmd.code == 108
  260.         if cmd.parameters[0] =~ /Slope: (\d+)x(\d+)/
  261.           xincline, yincline = $1.to_i, $2.to_i
  262.         elsif cmd.parameters[0] =~ /Slope: -(\d+)x(\d+)/
  263.           xincline, yincline = -$1.to_i, $2.to_i
  264.         elsif cmd.parameters[0] =~ /Slope: (\d+)x-(\d+)/
  265.           xincline, yincline = $1.to_i, -$2.to_i
  266.         elsif cmd.parameters[0] =~ /Slope: -(\d+)x-(\d+)/
  267.           xincline, yincline = -$1.to_i, -$2.to_i
  268.         elsif cmd.parameters[0] =~ /Width: (\d+)\/(\d+)/
  269.           ypos, yheight = $1.to_i, $2.to_i
  270.         elsif cmd.parameters[0] =~ /Offset: (\d+)px/
  271.           offset = $1.to_i
  272.         end
  273.       end
  274.       if xincline && yincline && ypos && yheight && offset
  275.         return [xincline, yincline, ypos, yheight, offset]
  276.       end
  277.     end
  278.     return [xincline, yincline, ypos, yheight, 16]
  279.   end
  280. end
  281.  
  282. class Game_Player
  283.   alias stair_cetc check_event_trigger_touch
  284.   def check_event_trigger_touch(dir)
  285.     return if on_stair?
  286.     return stair_cetc(dir)
  287.   end
  288.  
  289.   alias stair_ceth check_event_trigger_here
  290.   def check_event_trigger_here(triggers)
  291.     return if on_stair?
  292.     return stair_ceth(triggers)
  293.   end
  294.  
  295.   alias stair_cett check_event_trigger_there
  296.   def check_event_trigger_there(triggers)
  297.     return if on_stair?
  298.     return stair_cett(triggers)
  299.   end
  300.  
  301.   def move_down(turn_enabled = true)
  302.     turn_down if turn_enabled
  303.     if passable?(@x, @y, 2)
  304.       return if pbLedge(0,1)
  305.       return if pbEndSurf(0,1)
  306.       turn_down
  307.       @y += 1
  308.       $PokemonTemp.dependentEvents.pbMoveDependentEvents
  309.       increase_steps
  310.       moving_vertically(1)
  311.     else
  312.       if !check_event_trigger_touch(@direction)
  313.         if !@bump_se || @bump_se<=0
  314.           pbSEPlay("Player bump"); @bump_se = 10
  315.         end
  316.       end
  317.     end
  318.   end
  319.  
  320.   def move_up(turn_enabled = true)
  321.     turn_up if turn_enabled
  322.     if passable?(@x, @y, 8)
  323.       return if pbLedge(0,-1)
  324.       return if pbEndSurf(0,-1)
  325.       turn_up
  326.       @y -= 1
  327.       $PokemonTemp.dependentEvents.pbMoveDependentEvents
  328.       increase_steps
  329.       moving_vertically(-1)
  330.     else
  331.       if !check_event_trigger_touch(@direction)
  332.         if !@bump_se || @bump_se<=0
  333.           pbSEPlay("Player bump"); @bump_se = 10
  334.         end
  335.       end
  336.     end
  337.   end
  338. end
  339.  
  340. class Game_Map
  341.   alias stair_passable? passable?
  342.   def passable?(x, y, d, self_event = nil)
  343.     return stair_passable?(x, y, d, self_event) if self_event.nil?
  344.     return stair_passable?(x, y, d, self_event) if !self_event.on_middle_of_stair?
  345.     if y > self_event.y
  346.       return self_event.stair_y_position > 0
  347.     elsif y < self_event.y
  348.       return self_event.stair_y_position + 1 < self_event.stair_y_height
  349.     end
  350.     return true
  351.   end
  352.  
  353.   alias stair_scroll_down scroll_down
  354.   def scroll_down(distance)
  355.     return if $DisableScrollCounter == 1
  356.     return stair_scroll_down(distance)
  357.   end
  358.  
  359.   alias stair_scroll_left scroll_left
  360.   def scroll_left(distance)
  361.     return if $DisableScrollCounter == 1
  362.     return stair_scroll_left(distance)
  363.   end
  364.  
  365.   alias stair_scroll_right scroll_right
  366.   def scroll_right(distance)
  367.     return if $DisableScrollCounter == 1
  368.     return stair_scroll_right(distance)
  369.   end
  370.  
  371.   alias stair_scroll_up scroll_up
  372.   def scroll_up(distance)
  373.     return if $DisableScrollCounter == 1
  374.     return stair_scroll_up(distance)
  375.   end
  376. end
  377.  
  378. class Game_Character
  379.   attr_accessor :stair_start_x
  380.   attr_accessor :stair_start_y
  381.   attr_accessor :stair_end_x
  382.   attr_accessor :stair_end_y
  383.   attr_accessor :stair_y_position
  384.   attr_accessor :stair_y_height
  385.   attr_accessor :stair_begin_offset
  386.  
  387.   def on_stair?
  388.     return @stair_begin_offset && @stair_start_x && @stair_start_y &&
  389.            @stair_end_x && @stair_end_y && @stair_y_position && @stair_y_height
  390.   end
  391.  
  392.   def on_middle_of_stair?
  393.     return false if !on_stair?
  394.     if @stair_start_x > @stair_end_x
  395.       return @real_x < (@stair_start_x * Game_Map::TILE_WIDTH - @stair_begin_offset) * Game_Map::X_SUBPIXELS &&
  396.           @real_x > (@stair_end_x * Game_Map::TILE_WIDTH + @stair_begin_offset) * Game_Map::X_SUBPIXELS
  397.     else
  398.       return @real_x > (@stair_start_x * Game_Map::TILE_WIDTH + @stair_begin_offset) * Game_Map::X_SUBPIXELS &&
  399.           @real_x < (@stair_end_x * Game_Map::TILE_WIDTH - @stair_begin_offset) * Game_Map::X_SUBPIXELS      
  400.     end
  401.   end
  402.  
  403.   def slope(x, y, ypos = 0, yheight = 1, begin_offset = 0)
  404.     @stair_start_x = self.is_a?(Game_Player) ? @x : (@real_x / Game_Map::REAL_RES_X).round
  405.     @stair_start_y = self.is_a?(Game_Player) ? @y : (@real_y / Game_Map::REAL_RES_Y).round
  406.     @stair_end_x = @stair_start_x + x
  407.     @stair_end_y = @stair_start_y + y
  408.     @stair_y_position = ypos
  409.     @stair_y_height = yheight
  410.     @stair_begin_offset = begin_offset
  411.     @stair_start_y += ypos
  412.     @stair_end_y += ypos
  413.   end
  414.  
  415.   def clear_stair_data
  416.     @stair_begin_offset = nil
  417.     @stair_start_x = nil
  418.     @stair_start_y = nil
  419.     @stair_end_x = nil
  420.     @stair_end_y = nil
  421.     @stair_y_position = nil
  422.     @stair_y_height = nil
  423.     @stair_last_increment = nil
  424.   end
  425.  
  426.   def move_down(turn_enabled = true)
  427.     turn_down if turn_enabled
  428.     if passable?(@x, @y, 2)
  429.       turn_down
  430.       @y += 1
  431.       increase_steps
  432.       moving_vertically(1)
  433.     else
  434.       check_event_trigger_touch(@direction)
  435.     end
  436.   end
  437.  
  438.   def move_up(turn_enabled = true)
  439.     turn_up if turn_enabled
  440.     if passable?(@x, @y, 8)
  441.       turn_up
  442.       @y -= 1
  443.       increase_steps
  444.       moving_vertically(-1)
  445.     else
  446.       check_event_trigger_touch(@direction)
  447.     end
  448.   end
  449.  
  450.   def moving_vertically(value)
  451.     if on_stair?
  452.       @stair_y_position -= value
  453.       if @stair_y_position >= @stair_y_height || @stair_y_position < 0
  454.         clear_stair_data
  455.       end
  456.     end
  457.   end
  458.  
  459.   alias stair_update update
  460.   def update
  461.     if self == $game_player && SMOOTH_SCROLLING && on_stair?
  462.       # Game_Player#update called; now disable Game_Map#scroll_*
  463.       $DisableScrollCounter = 2
  464.     end
  465.     stair_update
  466.     if on_middle_of_stair?
  467.       @old_move_speed ||= @move_speed
  468.       ptgrs = Math.sqrt((@stair_end_x - @stair_start_x) ** 2 + (@stair_end_y - @stair_start_y) ** 2)
  469.       fraction = (@stair_end_x - @stair_start_x).abs / ptgrs * 0.85
  470.       @move_speed = fraction * @old_move_speed
  471.     else
  472.       @move_speed = @old_move_speed if @old_move_speed
  473.       @old_move_speed = nil
  474.     end
  475.   end
  476.  
  477.   alias stair_update_pattern update_pattern
  478.   def update_pattern
  479.     if self == $game_player && $DisableScrollCounter == 2
  480.       $DisableScrollCounter = 1
  481.     end
  482.     stair_update_pattern
  483.   end
  484.  
  485.   alias stair_moving? moving?
  486.   def moving?
  487.     if self == $game_player && $DisableScrollCounter == 1
  488.       # New Game_Player#update scroll method
  489.       $DisableScrollCounter = 0
  490.       @view_offset_x ||= 0
  491.       @view_offset_y ||= 0
  492.       self.center(
  493.           (@real_x + @view_offset_x) / 4 / Game_Map::TILE_WIDTH,
  494.           (@real_y + @view_offset_y) / 4 / Game_Map::TILE_HEIGHT
  495.       )
  496.     end
  497.     return stair_moving?
  498.   end
  499.  
  500.   alias stair_screen_y screen_y
  501.   def screen_y
  502.     real_y = @real_y
  503.     if on_stair?
  504.       if @real_x / Game_Map::X_SUBPIXELS.to_f <= @stair_start_x * Game_Map::TILE_WIDTH &&
  505.          @stair_end_x < @stair_start_x
  506.         distance = (@stair_start_x - @stair_end_x) * Game_Map::REAL_RES_X -
  507.             2.0 * @stair_begin_offset * Game_Map::X_SUBPIXELS
  508.         rpos = @real_x - @stair_end_x * Game_Map::REAL_RES_X - @stair_begin_offset * Game_Map::X_SUBPIXELS
  509.         fraction = 1 - rpos / distance.to_f
  510.         if fraction >= 0 && fraction <= 1
  511.           diff = fraction * (@stair_end_y - @stair_start_y) * Game_Map::REAL_RES_Y
  512.           real_y += diff
  513.           if self.is_a?(Game_Player)
  514.             if SMOOTH_SCROLLING
  515.               @view_offset_y += diff - (@stair_last_increment || 0)
  516.             else
  517.               $game_map.scroll_down(diff - (@stair_last_increment || 0))
  518.             end
  519.           end
  520.           @stair_last_increment = diff
  521.         end
  522.         if fraction >= 1
  523.           endy = @stair_end_y
  524.           if @stair_end_y < @stair_start_y
  525.             endy -= @stair_y_position
  526.           else
  527.             endy -= @stair_y_position
  528.           end
  529.           @y = endy
  530.           @real_y = endy * Game_Map::REAL_RES_Y
  531.           @view_offset_y = 0 if SMOOTH_SCROLLING && self.is_a?(Game_Player)
  532.           clear_stair_data
  533.           return stair_screen_y
  534.         end
  535.       elsif @real_x / Game_Map::X_SUBPIXELS.to_f >= @stair_start_x * Game_Map::TILE_WIDTH &&
  536.           @stair_end_x > @stair_start_x
  537.         distance = (@stair_end_x - @stair_start_x) * Game_Map::REAL_RES_X -
  538.             2.0 * @stair_begin_offset * Game_Map::X_SUBPIXELS
  539.         rpos = @stair_start_x * Game_Map::REAL_RES_X - @real_x + @stair_begin_offset * Game_Map::X_SUBPIXELS
  540.         fraction = rpos / distance.to_f
  541.         if fraction <= 0 && fraction >= -1
  542.           diff = fraction * (@stair_start_y - @stair_end_y) * Game_Map::REAL_RES_Y
  543.           real_y += diff
  544.           if self.is_a?(Game_Player)
  545.             if SMOOTH_SCROLLING
  546.               @view_offset_y += diff - (@stair_last_increment || 0)
  547.             else
  548.               $game_map.scroll_down(diff - (@stair_last_increment || 0))
  549.             end
  550.           end
  551.           @stair_last_increment = diff
  552.         end
  553.         if fraction <= -1
  554.           endy = @stair_end_y
  555.           if @stair_end_y < @stair_start_y
  556.             endy -= @stair_y_position
  557.           else
  558.             endy -= @stair_y_position
  559.           end
  560.           @y = endy
  561.           @real_y = endy * Game_Map::REAL_RES_Y
  562.           @view_offset_y = 0 if SMOOTH_SCROLLING && self.is_a?(Game_Player)
  563.           clear_stair_data
  564.           return stair_screen_y
  565.         end
  566.       else
  567.         clear_stair_data
  568.       end
  569.     elsif jumping?
  570.       ret = screen_y_ground
  571.       if @jump_count > 0
  572.         jump_fraction = ((@jump_count * jump_speed_real / Game_Map::REAL_RES_X) - 0.5).abs   # 0.5 to 0 to 0.5
  573.       else
  574.         jump_fraction = ((@jump_distance_left / @jump_distance) - 0.5).abs   # 0.5 to 0 to 0.5
  575.       end
  576.       ret += @jump_peak * (4 * jump_fraction**2 - 1)
  577.     end
  578.     if jumping?
  579.         return ret
  580.     end
  581.     return (real_y - self.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT)
  582.   end
  583. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement