So I guess I haven't posted in almost a month. Mainly due to a combination of:
- Only having about 30 minutes to an hour at any given time to work on RoboNinja, so by the time I get some work done on it, I don't have as much time to talk about it.
- The kids had "no screen week"in the middle of May, which meant I decided to take a week off from playing on my computer at home. ("playing" including my hobby programming!)
- I've had more home repairs than usual, so I've been busier in the evenings than I'd like
Anyway, despite all that, I've been still gradually making progress. First, I managed to get the minimap sorted out -- my build script goes through each map file and builds a minimap image once at build time. Then as you go through the world, it copies little sections from that image to a blank image that is gradually built up to be the minimap that the player can see. When the player saves his progress, I just save that image, and keep gradually copying to it. It's a little bit wasteful (copying the image every frame, and saving the whole image with the player's progress), but hey, that's what modern fast processors and nearly-unlimited storage are for, right? (This NEVER would have worked on the puny little Gameboy Advance!)
Then I had to work through some issues where things wouldn't work correctly after toggling out of the game, then restarting it. I'd get a black screen and crashes. Which turned out to be fairly obvious once I re-read the GDX documentation. All sorts of assets (textures, in particular) require you to pay attention to resource management, instead of just letting java take care of it. You need to manually release textures, and manually recreate them. In particular, toggling out of the game will destroy any textures you've loaded -- but the java object that tracks it remains. So I had to reload my textures when reloading the game.
Then I ended up having it mostly working, other than the slide powerup wouldn't work after resuming the game. You'd tap the screen to slide, and RoboNinja would just moonwalk to the right of the screen. It was weird. This took some debugging, but finally I realized I was creating a 2nd instance of my "powerup" object -- one connected to the UI, and the other connected to the actual in-game character -- so the UI ended up being disconnected from the actual ability. I had a factory class to instantiate my ability objects from their string ids, and it was happily returning a new instance to the UI when I recreated things. So I just needed to rework the plumbing to make sure that both the UI and the internal game state were using the same object instance.
Once that was done, all the bugs with pausing and relaunching the game seemed to be worked out.
Now I've started working on the "City" themed levels, which include an enemy robot that shoots lasers at you. I'm trying to set it up so that you can get through it if you haven't found some of the powerups in neighboring levels, but that it will be significantly easier if you do. It's taking some tweaking to get that difficultly level set.
|
Here I go dying again. I do that a lot. |