The game can now read in level data from the level editor

by midge 25. September 2014 02:25


So I spent a little time making a test level in the editor before switching back to iOS to work on some code for reading in the actual level data.

One observation about the level editor, and I think this applies broadly to a lot of things in work/life... if you're making a tool for someone or some other task, don't actually think it's awesome until you spend some time trying to use it. Listen to the people who use the things.

Trying to make a real-ish level with the editor exposed all the nuisances of the unintuitive UI and gave me a number of ways of how to make it better. I'm weighing the trade-offs of making the tool better vs just hunkering down and working through the annoyances. I guess it depends how much time I plan on spending in the level editor. That said, making even a quick sub-500 block length level was pretty time consuming.

Getting back to iOS... I had to write code to read in the level data, which is just a single column of hex strings, each hexadecimal number is one column of blocks in the game. So one row in the text file is one column in the game. A pretty simple format.

I'm rusty on iOS file I/O but stack-overflow definitely came to the rescue here. I was able to find plenty of samples trying to do some variation of everything I needed to do, so that wasn't too tough.

I must say, it's pretty exciting to see the first "real" level data load up.

I have to make the starting levels very easy, you can die VERY fast in this game. I may make a lot of shorter levels to start off with. Currently, the logic only detects a death if you hit a block. If you hit the top or bottom of the screen with no block, you don't die. I kind of like that, even if it doesn't make much sense. It can be a way to add easier parts to levels.

I still need to decide what to do for the "win" screen and have to detect the winning condition. I had hardcoded LEVEL_LENGTH in a lot of places earlier, I need to make sure the win condition is updated based on the real file level length.

Yayyy. Good progress.


Add comment

  Country flag

  • Comment
  • Preview

About the author

Hi, I'm Midge.

Month List

Page List