# Brawler - Depth & Jumping

This topic is 4166 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey all, I'm working on a Brawler (Final Fight, River City Ransom, et al.) and am a little curious about the best way to implement jumping. Here's the idea I've come up with: X,Y store the player's position relative to the ground. Height store's the player's position in the air relative to their spot in the ground. The higher the value, the higher you are in a jump. Rendering is simply draw at (X, Y - Height). Collision checks can be done with an X,Y box check then a Height check. Here's a picture describing what I mean: Does this seem like a good way to go about it? It's the first idea that popped into my head and am wondering if there are more efficient manners. Thanks all.

##### Share on other sites
Yes, this is a good way to go about this. Basically your characters will have their position described 3 dimensionally. The only complication is that you're rendering an isometric projection of the scene by drawing 2d sprites, so the height is drawn by altering the y value used to draw the sprite.

Really the way to combine the y value and the height might not be to just add them together, but rather to combine them depending on the camera angle. If the camera was parallel with the ground, the rendering point would only depend on the height. If the camera was pointing straight down, the rendering point would only depend on the y value. If 0 degrees is taken to be parallel to the ground, the actual formula would be sin(angle)*y + cos(angle)*height. But feel free to ignore this entire paragraph as I'm just getting carried away.

Oh, and the shadow will have to be separated from the character.

##### Share on other sites
Yeah, that should work.

I would draw the shadow as a separate sprite though. Like when you draw the character at x,y,z, just draw the shadow at x,y,0.

Out of curiosities sake, is that a sprite for your game, or is it a rip from like Samurai Showdown or something?

##### Share on other sites
Aye... I've got like an x,y,z parameters for my guys and if z-height does not equal "ground" then there is a shadow to draw. The various maps I got have a groundAt(x,y) inquiry method to detect something like this.

It will also possibly also help if you got slanted or multileveled grounds to work with. If you got one level of ground then you don't really need to do this.

##### Share on other sites
Scaling down the shadow (smaller as the character jumps higher) will help with depth perception, too.

##### Share on other sites
Quote:
 Original post by OluseyiScaling down the shadow (smaller as the character jumps higher) will help with depth perception, too.

Keeping it on the ground is important, too.

##### Share on other sites
Quote:
Original post by JohnBolton
Quote:
 Original post by OluseyiScaling down the shadow (smaller as the character jumps higher) will help with depth perception, too.

Keeping it on the ground is important, too.

Yes. Unless you're jumping over an obstacle, in which case it should be on the obstacle (and the scaling reduced proportional to the height of the obstacle).

##### Share on other sites
Thanks all.

The sprite is from Kagetsura from Sengoku 3. The shadow is drawn as part of the sprite and I didn't feel like removing it for prototyping.

Good idea on scaling the shadow based on the height. That should definitely help.

Rate++ all around.

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 15
• 18
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633360
• Total Posts
3011520
• ### Who's Online (See full list)

There are no registered users currently online

×