Inform: Example game using physics.h


Sun, 24 Dec 1995 01:45:01 -0500 (EST)

here is an example game (very short and non-pretty) using my physics.h
file I posted earlier.

---cut here---
Switches xv5;

Constant Story "TEST";
Constant Headline "^A Test!^by Sam Hulick^";

REPLACE RTakeSub;
REPLACE InsertSub;
REPLACE PutOnSub;

Include "parser";
Include "verblib";
Include "physics";

Object newselfobj "yourself"
with description "As good-looking as ever.", number 0,
before $ffff, after $ffff, life $ffff, each_turn $ffff,
time_out $ffff, describe $ffff, capacity 100,
parse_name 0, short_name 0, orders 0, max_space 100
has concealed animate proper transparent;

Object room0 "Room Zero"
has light;

Nearby lst "lambskin table"
with short_name [;
if (self has general) print "broken lambskin table";
else print "lambskin table";
rtrue;
],
parse_name [ i j;
if (self hasnt general) j = 'table';
else j = 'broken';
while (NextWord() == 'lambskin' or 'table' or j) i++;
return i;
],
description [;
if (self hasnt general)
"A lambskin table? It's very frail and thin! Be \
careful what you place on it!";
else "Well, you broke it, you klutz.";
],
max_weight 8,
max_space 10,
too_big [; "The table isn't big enough to hold that much."; ],
too_heavy [;
give self general ~supporter;
while (child(self) ~= 0) move child(self) to parent(self);
move noun to parent(self);
! 'noun' refers to the object we tried to place on the table.
! if we don't move it, it stays in the player's hands.
"The table breaks! Everything that was on it falls to the floor.";
],
has supporter static;

Nearby feather "feather"
with name "feather",
size 1, weight 1;

Nearby rock "rock"
with name "rock",
size 4, weight 15;

[ Initialise;
ChangePlayer(newselfobj);
location = room0;
player.max_weight = 30;
player.max_space = 20;
"^^^^^A test..^^";
];

Include "grammar";
end;

-- 
============================| "This lies very badly for the violin." --?
Sam Hulick                  | "Do you think, when the spirit moves me, I
shulick@indiana.edu         | think of your damn violin?"
http://129.79.1.4/~shulick/ |    --Ludwig van Beethoven (1770-1827)