I thought I had run out of things to talk about by this point, but of course by given how creative I am, there’s at least one more thing worth writing a blog post about.
Creativity doesn’t equal great so I’m not certain if this’ll be an interesting read, but let’s see how my blog writing can save it!
In Spirits of The Shogun when outside of fighting, the background scrolls with a parallax effect whenever the player pushes against the right boundary. When he/she stumbles upon enemies, the scrolling stops and the player is forced to fight the inbound wave of enemies. This effect is used to give the player an illusion that he really walks through a level containing a grass field and fight through waves of enemies.
What really happens is just the player making a ninja trying to exceed the right boundary and gets relocated to its horizontal position by doing so. However, a script inside each part of the background notices when this happens and tells each part to move at a speed. Each part moves at a different speed and that creates the parallax effect.
I’ve been through this briefly before in an earlier post but to new readers, when the player has traveled a certain distance (a value being reduced until 0, whenever the player pushes the right boundary) the apparent progression through the level will cease.
In the travelling phase, the right movement boundary was set on the right side, near the center of the screen. A good placement so the player wouldn’t be too near the edge when enemies appear.
However, in the fighting phase, the right boundary is set to the very right edge of the screen, meaning the player has more space to move around. That means a lot for the player since he/she has to dodge the incoming enemies and their melee/ranged attacks.
One question struck me hard though. If the traveling boundary was shorter than the fighting boundary, what happens when the player is exceeding the travelling boundary after the wave is finished?
The code would naturally make the player teleport back to the boundary, nothing wrong there. It’s just that it would certainly not look too good, and what does code know about beauty and grace?
I had to make some sort of smooth transition and that particular word gave me an instant solution. I would have the player simply slide back into place again instead of being teleported. No movement towards the right could be done while the player was sliding back. Thus no distance could be covered by exceeding the boundary and push it.
Also when the player slides back, I’d have to make the background scroll as well, to make it look like the ‘camera’ focuses back on the player, who’ll proceed through the level.
This transition had to be quick, because the player will be waiting to move again, so when the background scrolls while the player is sliding back, it will scroll much more faster.
The easiest part with that solution was to have a relaxing time with nothing more than just adjusting the speed of the player’s transition to the boundary and the speed of the background. I would have to make it look plausible too.
I don’t know if the implementation of the solution was done right, because I ended with two booleans that checked when the player pushes right. One that makes the distance left to the next battle being reduced and one that makes the background scrolling occur. I did have to split up my original boolean though, so the player couldn’t ‘cover distance’ while sliding back.
I think the special part with this is that we had no sort of camera that followed the player as he/she actually moved through a still image with occasional stand-stills as enemies appears. I don’t think that would have been the right way to create our game either. What it really is about is to create the solid experience you’d like the player to enjoy, no matter how you do it… It’s just that some ways does it better than others.