• entries
45
115
• views
54990

# Day 4

366 views

After much wrangling with the useful-but-crashhappy KDevelop, I hacked in the latest stuff into my tactical shooter. It now has 5 characters on the map, each of which will follow its own path simultaneously.

As always, I prototype things in the quickest way possible to get them working and then migrate all the globals into locals or members, etc. Regarding large designs and object models, I work on the principle of You Aren't Gonna Need It, which is a deliberately exaggerated way of saying you shouldn't design elaborate objects that are theoretically suitable for any purpose and reusable, when you may not end up using a lot of that functionality. Right now my Character class just looks like this:
class Character{public:    Character();	public:    int x, y; // position    Path currentPath;    int currentPathNode; // index into currentPath};

It's not elegant, and it is certainly going to grow as development continues. But there's little point me enumerating all the future methods now, because they will still change after that point. Similarly, the second public block will eventually become private, but I am waiting to see what sort of access patterns the code requires before I decide on an accessor interface that will allow me to make the members private.

My next day of coding may feature a change from tile-based movement to pixel-based movement. Characters already use the finer-grained coordinates so in theory this should just be a case of adding in an interpolation layer to move a couple of pixels at a time and a detection routine to see if the character is in the middle of the destination tile yet (with a little margin of error).

There are no comments to display.

## Create an account

Register a new account