(Originally, I was going to ask about using 3D in my game but doesn’t look like it will work for me.)
Last year, I started making a game. I called it RAW Race And Wreck, a 2D side scroll racing game. I got far enough to have a working “prototype”, but then came into a “roadblock” (no pun intended) that drained my motivation for it.
Essentially, I wanted a way to move up and down the road, to change lanes. Think of those 2D Beat 'em Ups, where you could move up and down the street, instead of only left, right and jump. Since I really wanted to use the physics engine, I just couldn’t get it to happen in the same smooth fashion.
Tried a few different approaches. Attempted to scale the vehicles to another size, but couldn’t get the positioning of the wheels to follow the scaling. Next, I adjusted the contrast but wasn’t an adequate solution. Finally, I have three different road tiles, one for each lane (plus two for the edges) with diffrent Z orders. Changing lanes then adjusts the player’s Z order. While this had a similar effect to what I wanted, it has a very rough effect, due to the vehicle either suddenly falling or abruptly jumping onto the next “lane” tile. This will also cause making levels more of a hassle, as I now need to lay down a minimum of three thin tiles closely to each other.
In the picture, the four lanes have yellow lines plus the top black one. The bottom black one is just a visual road edge.
Oh if you mean like Basically 2.5d, [Forget about this sentence Any object would probably work] “you could just make it a 3d object” basically then make walls so you cant pass, or just make it unable to pass a certain z Order. like lets say two conditions with the first being “if “object” Z order is less than 1” then other being “if “object” Z order is Greater then 10” then the action will be separating the object, Not sure if this is what you meant but i hope this helps
But also do not include the action i last said, make the action set the z order to where you want, and do not combine those two conditions, make them separate events, also make the object go lower/higher depending on the Z, and just make the map a little more top down with whatever angle just so it looks realistic
Why? It doesn’t seem like you are doing anything physics related, so why over complicate things? Physics uses forces which makes an object move until it runs out of momentum or something blocks it. That can lead to the object not moving in the way you intended.
Set the origin at the centre of the base of the sprite, in line with the bottom of the wheels.
However, personally I’d use a sprite with tweens to move smoothly between lanes.
Well, I’m going for an Elastomania/Hill Climb Racing style of game and really want the physics for the feel and effect it provides.
However, because I want collisions with other vehicles, there is a use for “lanes”. Otherwise, a player would get stuck behind slower vehicles and limited to jumping to get by them. More of a problem when only certain vehicles can jump on demand and opponents come in different sizes and speeds. Though I started by just changing z order, with a lane number on the HUD, I felt there really needed to be more of a visual indication. What I wanted was in line with Beat 'em Up games:
It is mainly a side-scrolling game with left and right movement, progress to the right and ability to jump. However, there is an area they can also walk up and down. Those games usually don’t use a physics engine, though.
Ok, so it’s mixed terrain, and not just straight roads?
Then moving the car will be tricky, because forces dampen and won’t get exactly to a position that you’re after.
However, you could put the car on a separate layer and then consider moving the camera on that layer instead of moving the car. You could set the physics masks and layer depending on what lane the car is in (for both player and opponents), which would only cause collisions for vehicles in the same lane.