Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / A fun new game!....Eventually.

Author
Message
Touch the Skies Edge
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 10th Oct 2013 08:21
So I've been working on a brawler style game, like double dragon or final fight, and I'm deadlocked, mainly with jumping. Anybody want to be a good samaritan and help?

Use whatever media you want to replace the files. All my stuff is just placeholders.

We all come to a time when we look at the entire picture and think... "Oh dear God, what horrible abomination of a code have I made?"
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 31st Oct 2013 12:46
What I tend to do for jumping, is to just have a Y velocity that is constantly increased, but set to a negative value when jumping. Your using Y for the actual Y position on screen, so you'd probably be better of using Z to signify the height. So, you'd position a sprite on X,Y-Z for example, when the character lands, they need to land on the same X,Y position.

Something like:

Dec ZS,0.1
if ZS<-1.0 then ZS=-1.0
Inc Z,ZS
if Z<0.0 then Z=0.0
Sprite 1,X,Y-Z

So ZS is the vertical velocity, it reduces by 0.1 each loop and affects Z, and the ZS is limited to >-1.0

To make the character jump, something like this would do it:

If Spacekey()=1 and Z=0 then ZS=2.0

I suggest making a type to hold character data like position, Z height, Z speed etc, and use an array - I think your as well doing that before adding jumping etc, because then things can be so much easier to work with. I suggest using indice 0 for the player, then the rest of the array can hold enemy data - but it can all be handled the same way. One of the biggest hassles in these sorts of games, is how to handle enemy and player interaction - whenever I don't do it this way, I wish I had.
When I made a remake of Bruce Lee, I did it this way and it made things so much easier. Like there's Bruce, a ninja, and a fat green dude, and in my game the ninja and green dude can be played by other players, or by AI. I just made my AI control the character as if it was a player - like I'm under a ladder so push up, I'm in front of the player so attack, there's a threat coming my way so jump. I ended up with quite a neat system that let players drop out and AI take over, then the player take over as they see fit. I think a similar system would make sense for a Final Fight game, it can make AI really straightforward, ideal for these sorts of games.

I am the one who knocks...

Login to post a reply

Server time is: 2024-04-19 14:50:58
Your offset time is: 2024-04-19 14:50:58