• entries
45
115
• views
55082

# Day 4

374 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. The swords are the characters and the blue colour is a path (which remains until it is fully traversed or replaced).

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).

PS. Due to the slowness of GDNet I seem to have double-posted this, yet I can't delete the earlier entry. I wonder if it is actually deleted but my super moderator X-ray glasses are allowing me to continue seeing the deleted post? Hmmmmm!

## 1 Comment

Quote:
 PS. Due to the slowness of GDNet I seem to have double-posted this, yet I can't delete the earlier entry. I wonder if it is actually deleted but my super moderator X-ray glasses are allowing me to continue seeing the deleted post? Hmmmmm!

Yes, it's the glasses. Unfortunately, deleted journal entries are shown without a 'deleted' tag or anything to moderators.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account