Light Racer 2.0 - Days 21-22 - Portals

The final stage of the game is called "Portals." When a player goes into a portal, he comes out facing a different direction on the other side of the map. It's simple but also risky. I randomized where the player comes out of so there's no way to guarantee safe exit when there are trails blocking parts of the other portal. Overall this map feature was fairly simple to implement and it makes for yet another interesting dynamic to the game. I'm very happy to be totally finished with map features because now I can go about assembling and tweaking everything to make the game really feel complete.

What was done - Day 21

Developed most of the portal code.

I thought that it might be cool if a portal would transport (or warp as the code calls it) a player to a random portal but I instead decided to code the portals up in pairs to make the game a little more predictable to play and easier to design. Portals can be positioned but will be created with two sides that exist on the edges of the world. When a player enters one side, their trail will be dropped and they will be moved to a random spot coming out of the opposite portal. This makes portals a bit of a gamble to use because the path may not be clear on the other end.

What was done - Day 22

I didn't get as much work done today as I was hoping to but I did get the code for the portals finished and I got the new graphic designed for it. I was thinking about animating it because I thought it could be cool to have a stargate-like thing but I ended up using a portal that looks a little more like a red ring.

I added a sound that is played when a player warps through but it doesn't sound as good as I'd like it to. I will have to search around or make a better sound.

I'm a little worried that there may be a problem with the player colliding with the back wall when it should be warping in the portal. My tests make it seem like everything is fine now but the code checks for wall collisions before portal ones so it could happen. The case would be when the player moves from in front to behind the portal in one tick (it would have to be 15 pixels, which could happen at higher speeds and if the game lags). The player collision code would see the wall first and kill the player before the portal code can see the player in the portal and move them. I'll come back to address this if it's an issue in play testing later.

This is the last level I'm designing. I'm very happy with the diversity of the different levels. The laser is so fun that I'm thinking about changing things a bit to have a level with 2 lasers. That could be challenging but really fun.

Here's what the portals look like:

PortalsPortals

And here's the video showing it in action: