Jump to content

  • Log In with Google      Sign In   
  • Create Account

I need help with a side scroller beat em all


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 tashaklikedi   Members   -  Reputation: 218

Like
0Likes
Like

Posted 04 June 2012 - 06:47 PM

Hi, I'm a newbie programmer who tries to make his own streets of rage / final fight like side scroller game.

As you know it, that kind of game has a pseudo 3D setting, with X and Y movement. So other than the X and Y variables that I use to move, I created a ground position hitbox (a rectangle), and an air position hitbox.

When you press the jump button, there is an initial velocity, a negative acceleration which is added to the jump velocity at each frame, and a condition that tells to land if the Y coordinate of the air position is lower than the Y coordinate of the ground position.

I hope I have been clear up to now...


Up to now, what I did successfully is running, jumping and walking in a limited area.

what I want to do next is to make my character jump between platforms like this:
http://www.youtube.com/watch?feature=player_detailpage&v=tXtNmRmiYC8#t=55s

I tried many things, but every time when I did one aspect of the issue successfully, it turned out that I messed up another aspect.

do you have any idea how this can be solved? after this I think everything will be easier (putting aside the AI)

Edited by tashaklikedi, 04 June 2012 - 06:48 PM.


Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 16419

Like
0Likes
Like

Posted 04 June 2012 - 06:52 PM

Can you describe the kind of problem you actually ran into? There are many ways that this can go wrong, but without knowing which issues you were specifically having, it's hard to know how to advise you :-)

#3 tashaklikedi   Members   -  Reputation: 218

Like
0Likes
Like

Posted 04 June 2012 - 07:29 PM

Sure!

I tried to make my character jump to a higher platform than the ground.

I created some rectangles to draw the map: some "ground" rectangles, in which you movement is allowed, and block rectangles, that block movement.

one of many approaches that I tried is that each ground rectangle has a int called "platform heigth". so if the value of our guy's ground Y position + the platform heigth is bigger than the Y value of the lower edge of the platform to reach, and smaller than it's Y value of the higher edge, the ground position would be equal to the air position. With this, the character was able to jump to the higher platform, but then he wouldn't jump anymore. And a weirder thing, at the lower end of the first platform if I jumped towards the lower end of the screen, the character will go through the allowed area, but only if I implement the function above.

another approach was to create another type of rectangle called "air". when the air position of the character was in that rectangle, he would be able to move in the air , and land once that he ran in a ground rectangle. Once again, he landed before he met that ground rectangle, and ended up in weird places.

I can't think of a simple and effective method to solve this problem...

#4 freakchild   Members   -  Reputation: 557

Like
0Likes
Like

Posted 04 June 2012 - 09:39 PM

I did a game once that solved this problem similar to your method where you keep track of the reference ground point the player jumped from. I had to track this point anyway in order to plot a shadow sprite i.e. I moved the shadow and tracked the reference point even when the player was jumping and moving through the air.

In order to detect whether the player had jumped up and was to land on a higher platform I simply checked to see if the reference point had collided with a block that represented the ledge. If so, I moved the reference point up based on the height of that ledge, which can usually be calculated by interrogating the map data. This moved the shadow up too.

In order to jump off a ledge I'd do the opposite of course...looking for the first floor block down from thin air, but adjusting the Y position according to the width of the path I'd just jumped from. This would allow me to retain what I called the depth position - how far into the background the character was and prevented the character from just simply landing on top of a 2D block and ruining the illusion.

I should add that I rarely only need to calculate the depth in these circumstances so it wasn't 3D in the sense I wasn't tracking 3 co-ordinates. It wasn't isometric either, so we just used to refer to this as 2.5D which really meant most collision detection and movement was 2D and the depth was just figured out whenever it was needed for the sake of maintaining the illusion.

Most of the collision detection was based on the shadow actually. If the shadow came up against a wall, then I knew the player had too. I would only really detect collision on the player to look for cases where he was jumping and his head would hit a block or other special cases.

#5 tashaklikedi   Members   -  Reputation: 218

Like
0Likes
Like

Posted 05 June 2012 - 05:45 AM

Thank you for your replies.

In order to detect whether the player had jumped up and was to land on a higher platform I simply checked to see if the reference point had collided with a block that represented the ledge. If so, I moved the reference point up based on the height of that ledge, which can usually be calculated by interrogating the map data. This moved the shadow up too.

In order to jump off a ledge I'd do the opposite of course...looking for the first floor block down from thin air, but adjusting the Y position according to the width of the path I'd just jumped from. This would allow me to retain what I called the depth position - how far into the background the character was and prevented the character from just simply landing on top of a 2D block and ruining the illusion.


My problem is that I can't even jump to another platform because my system doesnt allow me to do so. My character's ground position can not get out from the ground rectangles, and if he tries to jump off the ground rectangle, he can't because his ground position has to be in the rectangle. This works perfectly when on a single platform. But with mulitple platforms, I need additional rectangle types like the "air" type which says that your position is valid if your air position is in this rectangle. But that created very weird issues, like my character going out of the ground rectangle at unexpected positions.

I first tried to do it with the y axis: if my character's air position is inside the higher platform's limits, and if its value is lower than ground position + area heigth ,he would land to the higher platform, and then his ground position would be equal to his air position. With this, the character was able to jump to the roof, but then he wasn't able to jump at all because his air position was always smaller than the ground position + the area Heigth. I need to somehow offset the area heigth, but whatever I tried( I tried a lot of things, and it turned out to a spider web, since after a while I kind of stopped thinking and just tried random stuff) there was always a problem. I don't know if I can be clear enough since english is my third best language, so I'm sorry if this is hard to follow.

#6 wolfscaptain   Members   -  Reputation: 200

Like
0Likes
Like

Posted 05 June 2012 - 06:54 AM

I wonder why nobody ever makes actual 3D worlds for isometric side scrolling games.

It only makes sense to have a 3D representation if your world is 3D.

It also allows to use any image for floors and platforms and such, without the need to draw them with an orientation.

#7 BeerNutts   Crossbones+   -  Reputation: 3018

Like
0Likes
Like

Posted 05 June 2012 - 08:45 AM

I replied to a question like this, except he used Golden Axe as the reference http://www.gamedev.net/topic/618396-implementing-a-2d-side-scrolling-perspective-like-in-golden-axestreets-of-rage/

I'd suggest you send a message to Sean_Seanston and see if he got it working, and what he did for it.

My reply was:


I haven't done anything like this before, but I would suggest adding a z component to your players and your tiles.
So, your player has an x (horizontal) y (vertical on the 2d plane), and z (height). You use x and y for just moving a player around with the joystick.

When a player is just walking on the lowest level (ie, not on the cliff), they are at z of 0. When they jump, you increase the Z value, which, for screen coordinates drawing purposes matches the screen's Y value.

Your tiles would also have a z component, where the "lowest" would have 0, and the cliffs might have a z of 60 (I just picked some number). Again, in screen coordinates, it'd match Y of 60. When a player tries to walk over that cliff, you could check he's feet's y coordinates against the tile, and if the tiles have a higher z, then thet cannot walk on it; however, if the player jumps towards the cliff, and you increase the z, you would check if z >= cliffs z (60), and if so, you stop him ther, and draw him on the cliff, with his feet's z of 60.

Just a thought on how I'd probably do it.


My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#8 tashaklikedi   Members   -  Reputation: 218

Like
0Likes
Like

Posted 06 June 2012 - 03:28 AM

thanks all.

Beernuts: actually I was doing pretty much what you suggested. My "air position rectangle" is similar to your z idea. The reason of the problem was in fact that I didn't track on what rectangle my character was. once I did it, it worked perfectly. Now my character can jump to the higher platform, and can jump back down from it. once I implement a function for falling down, it will be all done ^^




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS