Author Topic: Creating a Jump system  (Read 2945 times)

0 Members and 1 Guest are viewing this topic.

Spoon

  • Tier 2
  • *
  • Posts: 6
Creating a Jump system
« on: April 03, 2009, 03:56:07 PM »
I just completed Quintessence up to Ch.#9, its very good - the plot is brilliant  : D
(saw two bugs, on the detection minigame on Ch. 3, theres a guard who walks through the roof and onto the top of it, and you can walk out of the top of the map when you travel to Eshe's village from the far top-right)

Back on topic!
I just wanted to make a simple jump system.. but I was having a few problems.
Firstly, the character jumps several times when I press it once,
And secondly, the character can jump to unwalkable areas,

I understand that this might not be the best place to come for help regarding my own RPG, and that Quintessense was probably written using custom scripts.. but... thought I might try ^^''

[Basicly I want it like the jump system you've got ^^]
Thanks a bunch!

My Event So Far (Simplified)
Spoiler: show
@> Conditional Branch: The L button is being pressed
   @> Control Variables: [0001: Direction] = Player's Direction
   @>Conditional Branche: Variable [0001: Direction] == 2
     $ Jump player +0, +2
   @>Conditional Branche: Variable [0001: Direction] == 4
     $ Jump player -2, +0
   @>Conditional Branche: Variable [0001: Direction] == 6
     $ Jump player +2, +0
   @>Conditional Branche: Variable [0001: Direction] == 8
     $ Jump player +0, -2

Forgotten_Bard

  • Tier 7
  • *
  • Posts: 2455
  • Gender: Male
  • Darkness2399
  • Current Mood: tired tired
Re: Creating a Jump system
« Reply #1 on: April 03, 2009, 04:15:28 PM »
have you considered telling it to stop after it does the move or "jump"  I don't have the code up right now since I am at school, but there might be a way... Trying to call all 40 somethin of those from memory >.<
A letter, a word
...
A sentence, a paragraph
...
A page, a story
...
A book, a novel.
...
They all mean so little when you can't take time to put your soul into the work.

Spoon

  • Tier 2
  • *
  • Posts: 6
Re: Creating a Jump system
« Reply #2 on: April 03, 2009, 04:24:39 PM »
Well basically.. for the second one, I need to check is the tile is walkable, if it is: jump to that point.

Forgotten_Bard

  • Tier 7
  • *
  • Posts: 2455
  • Gender: Male
  • Darkness2399
  • Current Mood: tired tired
Re: Creating a Jump system
« Reply #3 on: April 03, 2009, 04:26:01 PM »
i don't know about ruby but I would look for a canMove() kind of command, in the basic ones or the script
A letter, a word
...
A sentence, a paragraph
...
A page, a story
...
A book, a novel.
...
They all mean so little when you can't take time to put your soul into the work.

Reives

  • Dr Platplat
  • Director
  • Tier 7
  • ****
  • Posts: 11332
  • Gender: Male
    • Freebird Games
  • Current Mood: happy happy
Re: Creating a Jump system
« Reply #4 on: April 03, 2009, 04:29:28 PM »
Putting a Wait 10 frames or so command after that code would pseudo-solve the multiple jumps problem (unless the player keeps holding onto the key, which isn't really a bad thing imo). As for the passability problem; if you have the player on Through OFF mode and check the "Ignore if can't move" function in the movement command, it shouldn't be able to jump to unpassable tiles. :~ Good luck. Glad ya enjoyed the game, and thanks for the bug reports!

Forgotten_Bard

  • Tier 7
  • *
  • Posts: 2455
  • Gender: Male
  • Darkness2399
  • Current Mood: tired tired
Re: Creating a Jump system
« Reply #5 on: April 03, 2009, 04:31:28 PM »
no I know what to do as well XD
A letter, a word
...
A sentence, a paragraph
...
A page, a story
...
A book, a novel.
...
They all mean so little when you can't take time to put your soul into the work.

Spoon

  • Tier 2
  • *
  • Posts: 6
Re: Creating a Jump system
« Reply #6 on: April 03, 2009, 05:01:11 PM »
The wait 10 frames seems to work fine : )

My sound and animations still play when I tick the 'Ignore if can't nove'
Is there any way around this?
« Last Edit: April 03, 2009, 05:04:17 PM by Spoon »

Reives

  • Dr Platplat
  • Director
  • Tier 7
  • ****
  • Posts: 11332
  • Gender: Male
    • Freebird Games
  • Current Mood: happy happy
Re: Creating a Jump system
« Reply #7 on: April 03, 2009, 05:12:08 PM »
Oh okay, I see what your problem is. I had that problem when I was doing the Lunair bird form landing thing too. I wrote a little code snippet to get around it, here:

Code: [Select]
class Game_Player
def sound_2_sq_jump
    # Get x + y coords and facing
    x = $game_player.x
    y = $game_player.y
    direction = $game_player.direction
   
    # Modify coordinates to compensate for direction
    case direction
    when 2
      # Down
#change these ='2's to whatever distance you want the jump to be for all 4 directions
      y += 2
    when 4
      # Left
      x -= 2
    when 6
      # Right
      x += 2
    when 8
      # Up
      y -= 2
    end
   
    # Check if passable
    temp = $game_map.passable?(x, y, 0)
   
    # Save as variable
    if temp == true
      #$game_variables[100] = 1
      $game_temp.common_event_id = COMMON_EVENT_ID
    else
      #$game_variables[100] = 2
    end
  end
end

Near the bottom, change the COMMON_EVENT_ID to the ID of an available common event, and in that particular common event, add the code for the jumping, animation and sound effect.

Forgotten_Bard

  • Tier 7
  • *
  • Posts: 2455
  • Gender: Male
  • Darkness2399
  • Current Mood: tired tired
Re: Creating a Jump system
« Reply #8 on: April 03, 2009, 05:20:31 PM »
O.o
 O
A letter, a word
...
A sentence, a paragraph
...
A page, a story
...
A book, a novel.
...
They all mean so little when you can't take time to put your soul into the work.

Spoon

  • Tier 2
  • *
  • Posts: 6
Re: Creating a Jump system
« Reply #9 on: April 03, 2009, 05:26:30 PM »
Looks a bit complicated.. but I'll give it a try.... tomorrow.
I'll get back to you to say how it works.

Forgotten_Bard

  • Tier 7
  • *
  • Posts: 2455
  • Gender: Male
  • Darkness2399
  • Current Mood: tired tired
Re: Creating a Jump system
« Reply #10 on: April 03, 2009, 05:28:55 PM »
thanks to that beginers guide to Ruby that code made sence... no way in hell I could think up of it... but atleast I get it.... >.>
A letter, a word
...
A sentence, a paragraph
...
A page, a story
...
A book, a novel.
...
They all mean so little when you can't take time to put your soul into the work.

Spoon

  • Tier 2
  • *
  • Posts: 6
Re: Creating a Jump system
« Reply #11 on: April 06, 2009, 01:37:41 PM »
I have no experience with the Scripts

Do I need to put these lines in one at a time?
Or all into one?

'Near the bottom, change the COMMON_EVENT_ID to the ID of an available common event, and in that particular common event, add the code for the jumping, animation and sound effect. '
And.. how do I do this?

 - - - - - -

EDIT:
My friend helped me get the script in the right place.. (I think)
But what is the ID of a common event?  (JUMP / 0001 / 0001:Jump)
I tested it with a few of the above examples, but there was no change.

 - - - - - -

EDIT2:
Would it not be possible to have something like this in event form?
[I'd be able to understand this easier]
Obviously simplified:

Spoiler: show
@> Conditional Branch: The L button is being pressed
   @> Control Variables: [0001: Direction] = Player's Direction
   @> Conditional Branch: Variable [0001: Direction] == 2
     @> Control Variables: [0002: X Co-ordinate] = 0
     @> Control Variables: [0003: Y Co-ordinate] = 2
   @> Conditional Branch: Variable [0001: Direction] == 4
     @> Control Variables: [0002: X Co-ordinate] = -2
     @> Control Variables: [0003: Y Co-ordinate] = 0
   @> Conditional Branch: Variable [0001: Direction] == 6
     @> Control Variables: [0002: X Co-ordinate] = 2
     @> Control Variables: [0003: Y Co-ordinate] = 0
   @> Conditional Branch: Variable [0001: Direction] == 8
     @> Control Variables: [0002: X Co-ordinate] = 0
     @> Control Variables: [0003: Y Co-ordinate] = -2
   @> Co-ordinates X[Player location + 0002: X Co-ordinate] Y[Player location + 0003: Y Co-ordinate] are pathable then set [0001: Pathable] = ON
   @> Conditional Branch: 0001: Pathable == ON
     @> Play animation: Jump
     $> Jump X[0002: X Co-ordinate] Y[0003: Y Co-ordinate]


I've highlighted in red the bit that obviously doesn't exist, perhaps you could Script it?
The bit in green I'm also having problems with.. seen as I can't put the jump-values to my variables.

Thanks a lot : o
« Last Edit: April 15, 2009, 12:44:26 PM by Spoon »

Spoon

  • Tier 2
  • *
  • Posts: 6
Re: Creating a Jump system
« Reply #12 on: April 15, 2009, 04:37:50 PM »
Yep. I have no idea what to do...

BUMP D:

 - - - -

EDIT: Managed to do it! Problem solved ^^
« Last Edit: April 19, 2009, 03:10:17 PM by Spoon »

Reives

  • Dr Platplat
  • Director
  • Tier 7
  • ****
  • Posts: 11332
  • Gender: Male
    • Freebird Games
  • Current Mood: happy happy
Re: Creating a Jump system
« Reply #13 on: April 28, 2009, 09:08:10 PM »
What the-. . . I missed this topic's bumps until now. Glad you got things up and running, kudos! :reivsmile: