Friday, January 24, 2014

Dev Log: Horror Text Adventure #36

The player can now drop items they've picked up.  It appears as though if there are two of the same item in a room, and you want to pick one up, it picks up only one; but if you have two of the same item in your inventory, and you want to drop only one, it drops both.  Determining which of two similar objects you want to take or drop will require programming in adjectives.  That'll be fun.  Hopefully I'll make it so no two objects are alike (or the chance of them being identical is extremely low).

But dropping items works, for now.  The player can pick up a takeable item and put it down as many times as they like, of course.  During testing this I started to get really annoyed that the interface doesn't clear or scroll or whatever, so I definitely wanted to figure that out asap.

Turns out, scrolling is one line of code per box.  I thought it would be annoying, since my initial research on it made me assume it required a new listener, but it didn't even need that, which was nice.  I also thought it would add scrollbars automatically for some reason (why I would think that, I don't know), but thankfully it doesn't.

But even with scrolling, I noticed there aren't that many lines in each box, so I made the window size 960x800, which should be tall enough to display plenty of lines, and wide enough to prevent too much word wrap (before it looked like newspaper columns).  Fortunately, the window resizing was also one line, though I had assumed it would be more complicated, like I thought of the autoscrolling.  AS3/AIR is quite programmer-friendly sometimes.

screenshot of the game
More room now.  But now the menu feels off-center.
I also increased the size of the input box and word-wrapped it, so if the player is typing a particularly long message (usually when chatting, I imagine), they can see it all.  I've also been playing with capping the max input size, because I get annoyed in MMOs when players spam the chat.  But on the other hand, there isn't really a good balance; I can only reach a bad balance: if I cap at tweet-size, an evil player could still spam a string of W's in six lines, but a normal player talking might get annoyed by the limit (I know I sometimes can't get out what I want to say in a tweet).  So for now there is no limit, but I'll keep it in the back of my mind.

Now I am starting the work on adjectives.  I'm not quite sure how to make it work, to expand adjectives into the sentences I previously had (that way there is consistency between them), without having giant case or if statements.  But I'm sure there's an easy solution, just as there were for most other English things I had trouble with.

I also did a little cleanup on the Player class, just to reduce the lines, as well as add a couple constants for the interface in case I want to resize things again.

When you chat in the chat box it automatically adds "YOU:" to it, presumably to separate it from other players.  I've also been thinking about how to possibly make it so player names don't appear until you "know" the players' names, but that may be too annoying, and in any case that'll be far down the road when I get the multiplayer hooked up.

No comments:

Post a Comment