I’m working on a retro “pseudo 3D” game that is similar in style to Doom, or the old SNES “Mode 7” games. The issue I have, is during split screen play, I need the players to appear properly on the other player’s screen, depending on which way they are facing etc… this would be simple in 3D but with 2D, we need to swap textures at the correct time and I am lost… any ideas?
In cases like these you usually create directional silhouettes, traditionally 8.
Basically, you create your model (preferably 3d), and capture it from 8 cardinal angles (front, front left, right, back right, etc.) then you create a script that translates a direction into a cardinal silhouette, and you use that in a serialized networkview that you attach to your multiplayer characters.
Of course if you prefer more “resolution” you can simply increase the cardinality of the subdivision.
Okay, this is what we ended up doing. We have eight different sprites (one for each angle, you could do more for smoother animation). The we just compare angles between the objects. In our case, they are race cars. Something like this:
So that’s how we compare the angles (the Zone variables are simple floats that we assign a certain amount to… in this case we had them set as follows to add up to the total 360 degree movement.
private var fZone01 : float = 22.5f;
private var fZone02 : float = 67.5f;
private var fZone03 : float = 112.5f;
private var fZone04 : float = 157.5f;
private var fZone05 : float = 202.5f;
private var fZone06 : float = 247.5f;
private var fZone07 : float = 292.5f;
private var fZone08 : float = 337.5f;
Then, depending on what angle is set, simply change the object’s texture. Simple!
You’ll notice I commented out the sprite changing… this is because I also needed to do wheel spinning animation, so I did it all in a separate function and only required the angle var from this one.
There’s probably a much nicer way of doing all of this but it works