Double Dragon 2 (NES) - Physics and collision

Started by
6 comments, last by Buster2000 8 years, 9 months ago

Hi all,

First post from me in this forum. I'd like to code a game like Double Dragon 2 on the NES, using Python / Pygame. I know the original very well and I'd like to adapt most of its gameplay and physics.

The physics are pretty special though in these games,,, it's tile-based and that is fine, but some areas are like

2.5D, other are 2D sideview.

Here are some screenshots for those who don't know the game:

2.5D Area

25d3c52s9107b.png

2.5D "Steps"

25dstepd6tbju5h0r.png

2D Area

3di6zrck9eqa.png

So the game has mixed areas, even in the same level. Now I thought about how I could handle the physics.

In 3D areas, I thought about storing the ground position of each char and move this position around when walking. For jumping, the char stores an "air" attr. The chars hitrect will go up when jumping according to air, the ground position stays where it is (when jumping straight up). Here are some images for better understanding:

standfitxco9yvl.png

jump9i06g25xak.png

So I would use the groundposition for collision checking (in 2.5D areas). But for 2D areas, the same logic doesn't work anymore (I think?) Does anyone know how they made the collision stuff in this particular game? A tutorial about this, or just a good hint, would be much appreciated!

Thanks in advance and have a crispy day :-)

Advertisement
The only difference between a 2D and a 2.5D area is whether the ground is a very very thin rectangle (basically just a line) or not. All of the actual logic is identical.

Sean Middleditch – Game Systems Engineer – Join my team!

The only difference between a 2D and a 2.5D area is whether the ground is a very very thin rectangle (basically just a line) or not. All of the actual logic is identical.

Thanks, but can you please go a bit more into detail? I still don't get how it actually works and how I should go on.

I believe the same logic applies, so if you jumped in 2d you have a ground position. If you jump in 2.5d you have a ground position. If you jump you can always store the y-coord to where you should land when you come down. If you are jumping forwards or in an angle upwards then you can write the algorithm to increment the y axis based on the velocity and direction of the jumping.

In the 2.5D areas, can you move to the front and back instead of only to the left and right? Because that might complicate the situation. Otherwise the logic is the same as in the 2D areas. It will only be a visual change in those cases.


If you jump you can always store the y-coord to where you should land when you come down.

That doesn't work when the player jumps of a ledge. Unless I misunderstood what you meant by storing the y-coord.


In the 2.5D areas, can you move to the front and back instead of only to the left and right?

In double dragon, and in most arcade style games for NES (ninja turtles comes to mind), in the 2.5 d areas you can move front to back and side to side. There is a draw order here too - you will be drawn in front if you are closer - no surprise there really. These "2.5d" areas are part of what made these games so fun, especially for multiplayer.

To handle this movement I would just keep track of the sprites ground position and for the 2d parts of the map only allow x movement and for the 2.5 d parts of the map allow x and y movement and restrict your y range to the ground platform width. Then use your players and enemies ground position y coord to tell which should be drawn first.

As mentioned earlier, when something jumps you can predict where they should land at any given point in time and use that ground position y coordinate to do the depth sorting of sprites.

The only difference between a 2D and a 2.5D area is whether the ground is a very very thin rectangle (basically just a line) or not. All of the actual logic is identical.


This.

@Don Polettone:

Figure out the logic for your 2.5D areas, in particular some data-based way to determine whether the character is allowed to walk "into" (up) and "out of" (down) the scene. Once you've done that, realize that the 2D areas are exactly the same, except that the walk surface is only 1 pixel wide, prohibiting your character from walking "into" and "out of" the scene.

If you want to be devious, you can allow your characters to walk off ledges by extending the 2D surface into 2.5D, but marking the extended areas as fall-throughs.

The only difference between a 2D and a 2.5D area is whether the ground is a very very thin rectangle (basically just a line) or not. All of the actual logic is identical.


This.

@Don Polettone:

Figure out the logic for your 2.5D areas, in particular some data-based way to determine whether the character is allowed to walk "into" (up) and "out of" (down) the scene. Once you've done that, realize that the 2D areas are exactly the same, except that the walk surface is only 1 pixel wide, prohibiting your character from walking "into" and "out of" the scene.

If you want to be devious, you can allow your characters to walk off ledges by extending the 2D surface into 2.5D, but marking the extended areas as fall-throughs.

^This ^This

There is no 2D section and 2.5D section. The whole game is 2.5D.

This topic is closed to new replies.

Advertisement