Oil problems in Sweepy Cleaner

Something that’s been taking up a lot of my time recently is Sweepy Cleaner. I haven’t posted much as I don’t want to give away a lot of the content before people see it in action. However this level has been annoying me so much I’ve just got to post about it.

One of the later levels in the game is a garage, pictured above. The unique mechanic in this room is the big oil spill in the middle of the floor. It’s supposed to make the vacuum cleaner speed up and act a bit uncontrollable to make the game harder. This was my first problem really, I’ve tried lots of things including changing the cleaner rotation’s origin point to make it rotate off-centre. While this looked great the rectangle attached to the sprite is static and doesn’t rotate with the sprite, so all collisions were completely wrong. It could be possible to rotate it with the sprite but I don’t know enough about maths :P I’ve settled with increasing the speed of the cleaner and slowing it back down when you leave the oil.

It was still a bit easy, even easier than normal now as you can move round and suck up dust faster. I stuck an oil barrel in the middle and this is just the trick. The only problem is its round so I tried using a Bounding Sphere to handle collisions. I couldn’t get the thing to work though. The positions were all correct but the collisions happened way outside the barrel in a too big area. Sigh. So I went back to using rectangles and just made it smaller than the barrel so the cleaner doesn’t hit invisible corners. It still looks weird. Worst of all, now I’m experiencing big performance hits, with the FPS going as low as 23 and its very noticeable.

I’m already thinking of ways to fix the problems I’ve talked about here but I’m not sure it’s going to work. I’m thinking of completely rewriting the room based on what I’ve learnt. We’ll see.