   Jumping in a game like zelda
  So I was playing one of the GBA versions the other day since I was planning to make a small zelda game, and one thing got my attention: jumping.How is that kind of jumping done? Link basically jumps to get over a hole on the floor or something, but he always lands in the direction he was moving to. If we were to make him jump right when a monster was above him, he wouldn't get hurt as he's supposedly mid-air, so you could basically send him to the monster position just for drawing purposes, but while he's jumping, make it so you don't test collision with anything that's on the ground. However, there's also houses and other kinds of things you would have to check collision with, so you would also have to test collision with anything that's over the ground.To do this, I could draw different collision boxes for when he jumps and all, so it would only check collision for high objects, but is this the way to go? I think I'm probably missing something...Thanks in advance   
  Add an object, bool bIsJumping. This is used to tell us weather or not we are jumping, in psuedocode:if(pressed jump button && we are able to jump){  bIsJumping = TRUE;}else bIsJumping = FALSE;if(bIsJumping){  do stuff like collision detection for high stuff etc}else{  do stuff like collision detection for low stuff etc}   ;Quote:Original post by leet bixAdd an object, bool bIsJumping. This is used to tell us weather or not we are jumping, in psuedocode:if(pressed jump button && we are able to jump){  bIsJumping = TRUE;}1) 'bool bIsJumping' is not an "object".2) If you're going to suggest variable names, please, please don't suggest ones that include that awful Hungarian notation. The sooner we can all put that behind us, the better.3) In C++, the values that a bool can take on are spelled in lowercase: 'true' and 'false'.4) I think you completely misunderstood the OP's actual question.To the OP: I don't really know what you're trying to say.How is what kind of jumping done? How is the jumping that you're thinking about different from the jumping in every other game where the player jumps?What do you mean Link "wouldn't get hurt as he's supposedly mid-air"? What is the actual game rule? Is it "you can still collide with things in the air, but you don't take damage"? Or just what? And what does "send him to the monster position" mean?Walk me through this. Draw sketches if you have to.   ;  Let me try to explain with examples since I'm failing to do it with words.Imagine 'L' is Link, 'X' is a monster and '0' is room you can move to.00X000L00000Imagine both Link and the monster are standing still. In this case, Link doesn't get hurt as they're still next to eachother, but not colliding. Now, if you jump, you would technically move to the monster position since this is in 2D. However, Link shouldn't get hurt even though being on the same position as the monster, as he's jumping.So in this case:0XXX0LX00000Link should be able to jump over the monster to his right, land on the floor next to him, and remain unharmed. The only way he should get hurt would be walking up or right, as he would hit a monster.The reason why I was thinking of different collision boxes instead of making Link "invincible" on jump, was because this sittuation could also happen:Imagine 'H' is a house pixel.00HH0LHH0000In this case, Link would try to jump right, but hit the "ceiling" of the house.Would making two collision boxes for each monster/house/wall in the game be the way to go?I'm used to jumping in a platform game like Super Mario for example, but I'm having problems understanding how jumping works in a game like this, where you have a 2D world, but have a "3D world feeling". Sorry for the long post but this was the easiest way to explain.   ;  In this case I would just slide the players collision box to the right, but disable collisions for anything you can jump over i.e. mosters or holes, but not walls or trees. To do this you might have a flag in your collisions boxes to tell you weather or not it can be jumped, and also as mentioned before, have a variable to tell you if the player is jumping.  The last thing to do then would be to display the players image a little bit higher than where its bounding box is, to add some fake perspective.;  This is extremely simple.  When he gets into contact with a hole in the ground and you press the action button.  It checks to see if he's colliding with that object, being the hole while a button is pressed.  This in turns could activate a jumping = true bool.  Then an animation starts of a jumping move, while his x or y value change, depending on where he's jumping to match that animation.  Thus resulting him on the other side.  You would need to make a bool to only allow him to pass through the hole if a jumping action is occurring.   ;  Ah I see it now.. I really didn't want to make two collision boxes for everything and didn't think of that.Thanks everyone   ;  Ah, you're talking about something in "forced perspective", where the illusion of 3D is created by moving things up the screen, although that's also a valid walking direction.As in any game, you want to keep rendering separate from physics calculations. Link doesn't actually move up a square when he jumps. He's just drawn further up the screen than the square that he's actually in, in order to indicate that he's jumping.   ;  @ZahlmanWhat part of "in psuedocode:" wasn't clear?I think what leet bix posted served its purpose well enough.And if you dont know what hes really trying to say, then I would gather that you dont understand the OP's question either and certainly have no right to call somebody else out on it.In any event, given the information that the OP presented, leet bix's response is what I would have responded with as well since it's generally the basis of how jumping works. Right answer or not, we can only respond to the OP based on how the question is presented. So yes, more information would be helpful, which was eventually given.Quote:Original post by ZahlmanQuote:Original post by leet bixAdd an object, bool bIsJumping. This is used to tell us weather or not we are jumping, in psuedocode:if(pressed jump button && we are able to jump){  bIsJumping = TRUE;}1) 'bool bIsJumping' is not an "object".2) If you're going to suggest variable names, please, please don't suggest ones that include that awful Hungarian notation. The sooner we can all put that behind us, the better.3) In C++, the values that a bool can take on are spelled in lowercase: 'true' and 'false'.4) I think you completely misunderstood the OP's actual question.To the OP: I don't really know what you're trying to say.How is what kind of jumping done? How is the jumping that you're thinking about different from the jumping in every other game where the player jumps?What do you mean Link "wouldn't get hurt as he's supposedly mid-air"? What is the actual game rule? Is it "you can still collide with things in the air, but you don't take damage"? Or just what? And what does "send him to the monster position" mean?Walk me through this. Draw sketches if you have to.