title | author | created |
---|---|---|
July 17 2012 — getting things from the car |
Carl Mäsak |
2012-07-17 22:53:47 +0200 |
Having created enough of the game engine, I now have a very pleasant DSL-like thing in which to write crypt. Today in my commits I could write
.place_thing('car', 'clearing');
And then
.place_thing('flashlight', 'contents:car');
.place_thing('rope', 'contents:car');
.make_thing_openable('car');
This is much nicer than last year. And more flexible, as I hoped.
I found that in last year's game, I can examine the flashlight (which is in the car), even without opening the car and revealing the flashlight. Now, you might say, maybe the car has windows, but that wasn't the intent. I consider it a bug, caused by hard-to-follow placement logic. Let's do better this year.
-
We put a car in the clearing. Bam! Ain't that cute?
-
In relation to this, I discovered and fixed a bug having to do with programmer (my) confusion about when events are applied. Some tests failed because the game reported the things from the last room when walking from one room to another. Yes, this happens because of my factoring with events. I'm not completely used to it yet, it seems. Anyway, thank you, extensive test suite.
-
Now we put the flashlight and the rope in the car, and make them be revealed when we open it.
-
I make sure that a
look
command reveals the insides of things, for example the car. -
Then I make sure
examine
works from the CLI, and that when you open things, the CLI says what, if anything, is inside.
That's it for today. So what does the game look like now?
$ bin/crypt
CRYPT
=====
You've heard there's supposed to be an ancient hidden crypt in these
woods. One containing a priceless treasure. Well, there's only one way
to find out...
Clearing
The forest road stops here, and the gaps between the trees widen into a
patch of un-forest. The sky above is clear apart from a few harmless clouds.
You can go east.
> examine car
Small, kind of old, and beginning to rust. But it still gets you places.
> examine flashlight
You see no flashlight here.
> open car
Opening the car reveals a flashlight and a rope.
> examine flashlight
You see no flashlight here.
> take flashlight
Sorry, I did not understand that.
> quit
Well, we're not repeating last year's error, for sure. But the last two responses are wrong. Also, the car should appear in the description of the room. Let's fix all those things tomorrow.