I wonder how I could do this

Does anyone remember my racing game? I want to work on it again, but need to add a feature that I think would really help it. Currently, changing lanes isn’t very fun or good looking. Rather, I want to have a sort of look and effect like that of the original Excite bike and a lot of beat em’ up/brawling games. It would still be side scrolling, but would have a limited amount of room to move up and down on the track. In a sort of 2.5D/angled view, where you see the road at an angle. If this was non-physic, it would probably be easier, but not sure how with physics. Need away to move up and down, but adjust the physics to have the vehicle only interact with what is at that ‘level’. Made a quick drawing to help visualize that.
54t98ngft90cs70

This would be easier if you had a defined number of ‘lanes’ to move between, rather than your cars being able to move to any Y position within a given range.

For example, have 3 lanes. Cars in the top lane can only move down (1 or 2 lanes), cars in the middle lane can move up or down (only 1 lane), and cars in the bottom lane can only move up (1 or 2 lanes).

This could be implemented as a variable on each car instance (e.g. GreenCar.Variable(lane) = 3, OrangeCar.Variable(lane) = 1, etc.)

Then it’d be quite easy to have only cars in the same lane interact with each other.

1 Like

I remember your game, but not the details of what the changing lanes was like. And I’m of no help now but there was a GD game in the recent gamejam that had lane changing that might help you at least visualise the possibilities.

1 Like

I’ve been busy and haven’t tried it yet, but I am thinking of staying with the z-order system I have and adding the road to it. The path would be split up into multiple thin line tiles. Depending on which ‘lane’ they are, depends on what set of road tiles they interact with.

Edit Update: Tested it. The system I have for lane changing alters the z-order and the physics layer/masks. Each section of the road matched with the z-order, ph. layers and masks. Thus, the vehicle will “fall” into the closer lanes and “jump” onto the farther lanes. If I really wanted to smooth it out, I could make several 1 pixel thin lanes, but that would complicate scene creation, unless someone has a better idea…

2 Likes