Skip to main content
gamedev.net
🔒 Locked

Brawler - Depth & Jumping

Started by GroZZleR 6 replies 1.1k views
Original Post
GroZZleR
GroZZleR
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.
Vorpy
Vorpy
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.
the_dannobot
the_dannobot
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?
Bacon and Eggs
Bacon and Eggs
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.
Oluseyi
Oluseyi
Scaling down the shadow (smaller as the character jumps higher) will help with depth perception, too.
JohnBolton
JohnBolton
Quote:
Original post by Oluseyi
Scaling down the shadow (smaller as the character jumps higher) will help with depth perception, too.

Keeping it on the ground is important, too.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Oluseyi
Oluseyi
Quote:
Original post by JohnBolton
Quote:
Original post by Oluseyi
Scaling 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).
GroZZleR
GroZZleR
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.