[XP] Simple Jump Script

Started by nathmatt, November 12, 2009, 06:55:44 am

Previous topic - Next topic

nathmatt

November 12, 2009, 06:55:44 am Last Edit: April 19, 2011, 10:31:53 am by nathmatt
Simple Jump Script
Authors: Nathmatt
Version: 1.04
Type: Jump System
Key Term: Custom Movement System



Introduction

Its a simple Jumping script.



Features


  • Configurable jumping distance
  • Configurable off switch
  • Configurable no jump terrain tag
  • Configurable jump key if your using custom controls from tuns
  • Possibility to use jumping sprites



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


  • Nathmatt
  • Blizzard for his jump system in Blizz-Abs i used to make this



Author's Notes
No notes
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Shining Riku

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*

Blizzard

Nice work utilizing Blizz-ABS's system for this. xD I see that it even works with walls. :3
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

November 13, 2009, 04:03:30 pm #3 Last Edit: November 13, 2009, 05:45:27 pm by nathmatt
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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Shining Riku

November 13, 2009, 08:17:21 pm #4 Last Edit: November 13, 2009, 08:40:25 pm by Shining Riku
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*

Ryex

ya know if I was a mod I could db this :V:
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

nathmatt

updated to 1.03
now if using tons custom controls can change the jump key
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script