/*
Little Riding Hood, pesudocode version
Inspired by eri
By Emil Oppeln-Bronikowski
*/
mother = new Person(Person::Female);
rrh = new Person(Person::Female);
basket = new Items(Items::Basket);
scenery = new templates();
// First scene
scenery->load("home");
scenery->attach(mother);
scenery->attach(rrh);
// We need object in basket
mother->copyObjects(mother->stock, basket);
foreach(basket as food){
// learn rrh object what's in basket object by enumeration
rrh->addInformation(food);
}
mother->attachObject(rrh,basket);
grandma = new Person(Person::Female);
mother->addEvent(rrh, grandma->position());
scenery->load("woods");
wolf = new Animal(Animal::Wolf);
scenery->attach(rrh);
scenery->attach(wolf);
while(rrh->eventLoop()){
rrh->postition(
scenery->currentX, grandma->positionX(),
scenery->currentY, grandma->positionY()
);
if(wolf->style->visible){
rrh->stopEvent();
wolf->addEvent(
self,
array(
avg(grandma->positionX()),
avg(grandma->positionY())
)
);
rrh->continueEvent();
}
}
scenery->load("house");
scenery->attach(grandma);
scenery->attach(wolf);
// FIXME: just a hack
grandma =& wolf;
wolf->addListener(rrh);
scenery->attach(rrh);
while(instanceOf(rrh) != Person){
rrh->nextQuery();
switch(grandma->ansferQuery(rrh->lastQuery())){
case 'TO_SEE';
break;
case 'TO_HEAR';
break;
case 'TO_EAT';
grandma->inherit(rrh);
~rrh();
break;
}
}
ranger = new Person(Person::Male);
scenery->attach(ranger);
ranger->attach(Weapon::Boomstick);
ranger->destroy(wolf); // makes .guts public
foreach(wolf->guts as people){
rescued[] = People::LoadInstance(people);
}
if(rescued.count() > 1){
scenery->load("happyEnd");
}else{
// hmmm, I need some kind of story exception here?
}
Tags Pisanina, µGeek
Leave a Reply
February 26th, 2008 at 11:56 am
hmmm….
A co na to Twój lekarz?
February 26th, 2008 at 12:13 pm
Mówi żebym pisał dalej. ;-)
February 26th, 2008 at 1:23 pm
Fajne, ale znalazłem błędy :> .
February 26th, 2008 at 1:34 pm
@Haker (tajemniczy;): Hej, my tu pracujemy wg. “It compiles? Ship it!” ;-)
March 25th, 2008 at 11:55 pm
I love it!
Tylko czemu te odstępy są podwójne? Burzy mi Zen :P
March 29th, 2008 at 10:24 am
Padłem :P