I spent a little more time on the controls than I thought I would. It didn’t feel right. I tried something simple at first:
if (an arrow key has been pressed since the last update)
velocity = 1.0
player.setDirection(the direction of the arrow key)
if (an arrow key has been released since the last update)
velocity = 0.0
It worked well enough. The Castaway moves at a constant speed until the key is released, then he comes to a complete halt.
The problem was that if you are switching directions periodically, sometimes the velocity drops to 0 even if you feel like you should keep moving.
So I changed it. Now, instead of checking for key release, I check the status of all four arrow keys. If none of them are currently pressed, THEN set the velocity to 0.0. Otherwise, allow the movement to continue.
It feels much better.
I’ve also added some message routines. Basically, if there is a message to display to the player, it will end up in a queue with a timer. When the message is visible, the timer ticks down to 0, and it removes the message from the queue for the next one. It took me all of 15 minutes to implement.
And instead of a giant purple emptiness, I added some tiles.
In this Shipwrecked message queue video demo, you can see all of the elements of the project in action, including being able to read a few lines in the Castaway’s diary:
I simply painted the tiles down using for-loops, so the Castaway could walk on water right now if I let him.
So the next big things to do:
- Add a map. A big one that spans more than a single screen.
- Make the camera center on the Castaway as we explore the map.
- Give the player something to do other than explore the map.
My worry is that I’ll get to the end of the month without any game play. I still haven’t exactly figured out what actions the player has, nor what the ending looks like.
It’s partly because I’m worried that I’ll be too ambitious. For instance, if I implement the ability to get heat stroke, it means the player needs to be able to avoid it, which means finding or building shelter. Do I have time to implement the ability to collect resources and build a lean-to (as well as draw one that looks half-decent)?
These last few things have come together quickly. Maybe I’ll get lucky and won’t have to compromise entirely on the concept of a Castaway surviving on a desert island after a shipwreck.