Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: nathmatt on November 12, 2009, 06:55:44 am

Title: [XP] Simple Jump Script
Post by: nathmatt on November 12, 2009, 06:55:44 am
Simple Jump Script
Authors: Nathmatt
Version: 1.04
Type: Jump System
Key Term: Custom Movement System



Introduction

Its a simple Jumping script.



Features




Screenshots

Um screenshot would be just ur player jumping


Demo

no demo


Script

Above main
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Simple Jump System by Nathmatt
# Version: 1.04
# 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 SJS_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 check_key && !jumping? && !$game_switches[SJS_Config::Off_Switch_id]
      d =  SJS_Config::Jump_Distance
      case direction
        when 2 then jump(0,d,false)
        when 4 then jump(-d,0,false)
        when 6 then jump(d,0,false)
        when 8 then jump(0,-d,false)
      end
    end
    if jumping? && SJS_Config::Jump_Animation
      @character_name_org = actor.character_name
      @character_name = @character_name_org+'_jmp'
    end
    if @character_name != actor.character_name && !jumping?
      @character_name = actor.character_name
    end
     
  end
   
  def check_key
    if $tons_version != nil && $tons_version >= 5.40 &&
        TONS_OF_ADDONS::CUSTOM_CONTROLS
      return Input.trigger?(Input::Key[SJS_Config::Jump_Key])
    else
      return Input.trigger?(Input::A) 
    end
  end
 
  alias SJS_jump jump
  def jump(x,y,c=true)
    px = $game_player.x + x
    py = $game_player.y + y
    if c
      SJS_jump(x,y)
    elsif $game_map.terrain_tag(px,py) != SJS_Config::Cant_Jump
      SJS_jump(x,y)
    end
  end

end



Instructions
Configuration in script
Uses default button (A) to jump


Compatibility
no compatible problems known


Credits and Thanks




Author's Notes
No notes
Title: Re: [XP] Simple Jump Script
Post by: Shining Riku on November 12, 2009, 06:56:26 pm
This looks awesome. I'd sure use it if I could turn it off in-game. Handy stuff!

Looking good so far though. *powers up*
Title: Re: [XP] Simple Jump Script
Post by: Blizzard on November 13, 2009, 04:31:22 am
Nice work utilizing Blizz-ABS's system for this. xD I see that it even works with walls. :3
Title: Re: [XP] Simple Jump Script
Post by: nathmatt on November 13, 2009, 04:03:30 pm
actually $game_player.jump reads if something is not passable automatically so only had to check the terrain tag


edit: updated to 1.01 added turn off switch
edit: updated to 1.02 added ability to use jump sprites
Title: Re: [XP] Simple Jump Script
Post by: Shining Riku on November 13, 2009, 08:17:21 pm
This is EXACTLY what I wanted! YAY!

The switch was enough to buy me in, but the jumping sprites makes it that much more awesome!
I am so using this! *levels up again*
Title: Re: [XP] Simple Jump Script
Post by: Ryex on November 16, 2009, 11:17:47 pm
ya know if I was a mod I could db this :V:
Title: Re: [XP] Simple Jump Script
Post by: nathmatt on January 23, 2010, 11:34:58 am
updated to 1.03
now if using tons custom controls can change the jump key