24 July 2008

It's late, I'm tired and it doesn't work


Spent the evening tidying up my code (in the refactoring sense) and implementing a tiled, wrapping background.

Everything in the game is stored with World coordinates, relative to an arbitrary point in the world (that just so happens to be the bottom left of the first background tile). The ship is always centred horizontally, and normally centred vertically except when near the top or bottom of the world.

From the ship position, I can calculate bounds for the view (the area of the world to be drawn on the screen), and from this screen coordinates for the objects we need to draw, and an xy offset for the tiles. I can also calculate which tile to draw, and if needed draw a second.

I've stopped for the night (which goes against the grain, but I'm already over tired), with bits not working. I'm having resource issues with some image files I've renamed not being updated on the iPod (looks like a case sensitivity bug) and errors in my maths that cause a few amusing visual errors before the game crashes.

From the picture of the simulator, you can see not everything is rosy. What you can't see is that the ship is flying backwards, the tiles are in the incorrect order, and once a join reaches half screen, the right most tile stops dead while the left one keeps moving until it covers it. Fun for the whole family.

More tomorrow.

1 comment:

  1. Put the code aside and back up.
    Do a little step at a time.

    Even just a tiled world that scrolls left and right when tilted.

    Then put that aside and copy it to new code and put your ship back on the tiled back ground.

    Same with audio. I am not sure how complicated it is on the IPOD but with mine its one small step at a time and make your own API on the way too so the rest of us can play with it..

    Every major change to my pong I make a remark at the top of the code and save it off with an incrementing number at the end. That way I can back up as needed to working code.

    If I know you you will already have a full version control in place already. If not no doubt it will be that you were so excited hacking the IPOD lol...

    Mike

    ReplyDelete

Please note, comments are moderated which means they won't show up until I OK them. This seems to be the most effective way of stopping comment spam.