Hello all,
Below is a code for a jumping script.
It works great however I just want to be able to change one little thing...
If a player can Jump the distance (In my example 6 tiles) but can do it 4 or 3 because that's where the closes landing point is, then I'd like my character to be able to do that, instead of jumping the full 6 squares.
I've looked though a number of Jumping Scripts and did a pretty wide google search and found nothing...
Any support would mean the world to me
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Simple Jump System by Nathmatt
# Version: 1.03
# Type: Custom Movement System
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This is the config:
#
# (Jump_Distance) is how far you want to jump.
#
# (Cant_Jump) is the terrain tag that you cant jump on.
#
# (Off_Switch_id) is the swith id used to turn off the jump.
#
# (Jump_key) is the key used to jump if using tons ads custom controls.
#
# (Jump_Animation) is if you want a speacial graphic for jumping
# add _jmp so 001-Fighter01 would be 001-Fighter01_jmp.
#
#-------------------------------------------------------------------------------
module Nathmatt_Config
Jump_Distance = 2
Jump_Animation = false
Off_Switch_id = 50
Jump_Key = 'Space'
# Terrain_Tags
Cant_Jump = 1
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This is the update method:
#
#-------------------------------------------------------------------------------
class Game_Player < Game_Character
alias nathmatt_update update
def update
nathmatt_update
actor = $game_party.actors[0] unless actor == $game_party.actors[0]
if $tons_version != nil && $tons_version >= 5.40 &&
TONS_OF_ADDONS::CUSTOM_CONTROLS
if Input.trigger?(Input::Key[Nathmatt_Config::Jump_Key])
unless jumping? ||
$game_switches [Nathmatt_Config::Off_Switch_id]
c = Nathmatt_Config::Cant_Jump
d = Nathmatt_Config::Jump_Distance
case direction
when 2 then jump(0,d) unless check_terrain(0,d,c)
when 4 then jump(-d,0) unless check_terrain(-d,0,c)
when 6 then jump(d,0) unless check_terrain(d,0,c)
when 8 then jump(0,-d) unless check_terrain(0,-d,c)
end
end
end
else
if Input.trigger?(Input::A)
unless jumping? ||
$game_switches [Nathmatt_Config::Off_Switch_id]
c = Nathmatt_Config::Cant_Jump
d = Nathmatt_Config::Jump_Distance
case direction
when 2 then jump(0,d) unless check_terrain(0,d,c)
when 4 then jump(-d,0) unless check_terrain(-d,0,c)
when 6 then jump(d,0) unless check_terrain(d,0,c)
when 8 then jump(0,-d) unless check_terrain(0,-d,c)
end
end
end
end
if jumping? && Nathmatt_Config::Jump_Animation
@character_name_org = actor.character_name
@character_name = @character_name_org+'_jmp'
end
if @character_name != actor.character_name
@character_name = actor.character_name unless jumping?
end
end
def check_terrain(x,y,condition)
px = $game_player.x + x
py = $game_player.y + y
if $game_map.terrain_tag(px,py) == condition
return true
else
return false
end
end
end