Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Jump Puzzle Help

Hey there guys.
Problem
I'm making a puzzle, a jumping one in fact. You have to jump to tiles in order to progress through the room... However I have encountered a problem with the code I am using (see below). It is currently allowing the player to jump anywhere, including the black floor and non-passable tiles, which is where I do not want him to jump to. I am calling the common event below, when the action button is pressed (so basically, press enter and the player jumps).

The Question
How do I make it so that when the player jumps, the hero will jump forward three tiles onto another tile, but when there is a non-passable tile such as the black floor, he will not move anywhere, and instead wait for him to press enter whilst facing another direction?

Here is the code:
Code:
if player is facing right
   set move route: player (Skip, Wait)
     jump +3, 0

if player is facing left
   set move route: player (Skip, Wait)
     jump -3, 0

if player is facing down
   set move route: player (Skip, Wait)
     jump 0, 3

if player is facing up
   set move route: player (Skip, Wait)
     jump 0, -3

Thank you very much,
~Brad.
 
Hum... I have an idea, but it might take a while...

Make 2 variables for each coordinate (like, variable 1 represents the X of that tile in the map, and variable 2 represents the Y of that tile in the map). And then make a condition like...

IF Player is at Variable X = 3 and IF Player is at Variable Y = 1 THEN IF Button ENTER is pressed, nothing happens. For this to be true, you have to admit the unjumpable tile is at (0, 1). So, you'd have to do this for coordinate X = 3, 2 and 1.
 
I understand that idea, but for the amount of tiles on the map that would take hours.
Thank you anyway.

I remember doing this in XP, and it worked fine.
Bare in mind that I wouldn't have been able to make that much of a complicated system back then, so it musn't have been too hard.
 
No, they do. They did it on XP, I remember having the Player jumping into the middle of a mountain, and then, staying there, stucked. I actually used that to make some cutscenes on where characters would fall of high cliffs.

It would be hard to do it my way, but not that hard. Yes, it would take hours after you finished a map, but it's just copy-paste.

But I guess it's not worth it to do it... But, what if you make the same thing with a common event? Then you'd just have to copy the event for jumping left, right, up, down.
 
If I had more VX knowledge I'd be of more help here...does VX still have terrain tags and scripts in conditional branches?
if it does, you could put in another conditional branch based on script saying
!$game_map.terrain_tag(x+-jump,y+-jump) == "some terrain tag"
and then do the rest
to make that work, simply have a variable for the x and y position of the player and, based on what direction you're changing in set the x and y in the cond. branch up like so
($game_variables[player x var] +/- bleh, $game_variables[player y var] +/- bleh)
just remove the +/- bleh bit to your need in terms of where you're jumping (so say, if the player is facing right, simply use + 3 instead of +/- bleh before the comma, and remove +/- bleh altogether after the comma)
I have no idea whether or not that will work since I can't test it. But I figured, if there's a chance it's helpful, I might as well post it XD
 
I don't think VX actually has terrain tags. As for NunoAle, yes I know it worked in XP, as I said... :/

But for some reason, the skip if cannot move function does not prevent the player from reaching their destination because the player is JUMPING. This is why it ignores the function.
 
Well if your trying to do it like this:


[]  []  []

[]  []  []


More or less, then just only input the event commands for tiles it cant jump to.  I mean, instead of putting conditional branches for facing up, down, left or right, for like the top left corner one, only put conditional branches for jumping right and down.

That's what I did in my VX jumping puzzle, and I haven't encountered any problems, really.
 
well, I installed VX, and my system works but for a couple of details.
All you have to do in a parallel process event is have it set 2 variables to the player x and y
then come the conditional branches...
you probably already have one for a btton that needs to be pressed, so I won't bother with that.
You simple create all the "left,right,up,down" conditional branches as you did, but, within each branch, you put another one based on the script
Code:
$game_map.passable?($game_variables[player X var_nr] +/- 3, $game_variables[Player Y var_nr]+/-3)
and then you do your jump command. Remember, you only have to put in the +/- 3 for where the player will be using. It works perfectly for me.

NOTE: this will NOT check whether there is an impassable event on the map though, only the actual tiles
 
@xephyr14
Yes, I know that system and it would work perfectly on my system. However as I said, due to the large nature of the map it would take an extremely long time to make, therefore, me being lazy, I was wondering if anyone else had any more efficient methods.

@Beran
Thanks so much for all your help. I'll try it now!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top