Skip to content

Instantly share code, notes, and snippets.

@booyaa
Last active August 29, 2015 14:07
Show Gist options
  • Save booyaa/e225b6b8ab7cdde24561 to your computer and use it in GitHub Desktop.
Save booyaa/e225b6b8ab7cdde24561 to your computer and use it in GitHub Desktop.
Stackanoid - post mortem

Stackanoid - 5th game in the One Game A Month Challenge

Beginning

The game started as a doodle, messing around with 2D physics and wasn't even the first iteration. I had started playing around with spinning and swinging objects, also hinges seem to be equally promising and certainly easier to grasp in the 2D vs the 3D versions.

The concept of stacking items as a game mechanic happened after the 3rd iteration. I had noticed a curious property of objects interacting with the player sprite. If a falling object landed on the player sprite you could move it up and down, but the object would slip off if you moved left and right.

Fixing a problem

Naturally this behaviour was irritating, I don't really understand why this happens, but thanks to Unity answers I was able to work how to avoid the problem. The trick was to set the object's transform match that of the player's when it entered the collision. If the object collided with a fixed platform, it was easiest enough to unstick it provided you had saved the object's old transform.

So now I had a demo that wasn't particularly fun, but it proved that I could stick things to the player. I wondered how hard it would be to stack things.

Sticky stick is sticky

Getting items to stack was fairly straightforward to implement, by adding another property to the sticky code you could then check if the item you collided to had isStuck property or was the player. If it was the player then the property got set. The code works fairly well, but physics starts to make this very tricky after stacking three items, think balancing a tower of plates and then you can imagine what happens when you go beyond three. Which is odd given that each stack object is mirror the transform of the paddle.

Food falling to their doom

Stacking (actually it felt more like scooping) items was starting to be fun, but it did need a challenge. Given that I was already prototyping with food related sprites, I figured why not add conveyor belt and get the player to catch the items as they fall off the end of the belt.

Initially I drew a blank on how to get the gameobjects to move towards the middle of the screen, but thankfully I remember this one crazy trick from MindCandy's Learning Unity series. I could set an empty game object at the centre of the screen and get the food to move towards it. Gravity would take care of the rest.

During testing I discovered that adding box colliders to individual prefab blocks that made a platform was a bad idea. If the tiles didn't match up perfectly, the food objects would get stuck. In reflection I should've created by tile prefab without a collider, but wrap the various sizes e.g. 1x1, 1x5 prefab groups in a collder instead.

The burger game that never was

I got a flash of inspiration as to the direction that I wanted to take the game. At the time I was still hopeful I could align my game with September's 1GAM theme of the fair. The idea was a burger making game where the various food items moved along the conveyor belt and you had to stack the items to make a burger.

During the scoring process (you dropped your caught items onto a scoring platform which was a different colour from the conveyor belt platforms) I counted how items touched the platform before the player left the scoring platform.

This revealed my first serious bug, if I drop the player onto the scoring platform tde stack of food item would only count those items that crossed the scoring platform before the player left it. This meant having a stack of four might only score two. My workaround was to nudge the player into moving up to the platform rather than dropping off. The "nudge" was to move the platform so it was nearly flush with a conveyor belt. It was a kludgy workaround and I would've prefer a method that allows you to use either method of delivering food to the platform.

Also what the hell is up with a scoring platform anyway? A better solution would've been another conveyor belt that moves the completed food items away from the screen.

I decided I would try making burger related graphics. In the end I think this is what scuppered my plans for SPACEFAIR BURGER JOINT SIMULATOR 2014. I just couldn't get my finger out. Which is a shame, if I'd even spent a week drawing I'd have easily had all my assets. In my defence I'm blaming the day job which currently has me working very long hours (including weekend work).

Who knows maybe I might revisit SPACEFAIR BURGER JOINT SIMULATOR 2014 one day(tm).

Pivoting, it's not just for spreadsheets

My recollection of the last weeks are a bit hazy, but there was a realisation that I wasn't coming up with the graphical goods. So I decided to use my existing prototyping sprites, but I was now stuck because using the stacking/combo making mechanics of the burger game just didn't make sense without burgers.

With time starting to run out, I copped out and went for survival mechanics i.e. if the food lands on the floor it's game over. I needed to find a way to increase the difficulty over time, I'd thought about speeding up the food travelling down the belt, but this wasn't particularly exciting and might overload the player during the start of the game.

What I went for in the end was to activate more spawners over time. At the time of writing this postmortem this is major bug in the game. There's meant to be four spawers activated but only two work.

On the last night to submit September's 1GAM

I still hadn't fixed the buggy spawners, but bugs asides the game wasn't remotely finished. I needed a start screen and needed to wire up the game over panel. Thankfully the new UI system makes this a doddle. Code I didn't use in the end because of time constraints was a high score service and point of death screenshot (a bit like Jetpack Joyide).

I'm planning on turning a lot of the code I wrote for this 1GAM into my template project. You always need an opening screen and a gameover panel! I wish I had stuck some music on, the ambient machine noise just doesn't cut it for me.

Linkies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment