[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-devel] Third addition - makeing rubber band objects work
From: |
FilE/TaRôM |
Subject: |
[Enigma-devel] Third addition - makeing rubber band objects work |
Date: |
Mon, 3 Oct 2005 19:30:42 +0200 |
User-agent: |
KMail/1.6.1 |
---------------- CODE BEGIN ----------------
namespace
{
class Rubberband : public Item {
CLONEOBJ(Rubberband);
DECL_TRAITS;
ItemAction activate(Actor *actor,GridPos p) {
double strength = 10.0;
double length = 1.0;
double_attrib ("length", &length);
double_attrib ("strength", &strength);
string o1 = "";
string_attrib("object1",&o1);
string o2 = "";
string_attrib("object2",&o2);
Actor *obj1 = dynamic_cast<Actor*>(GetNamedObject(o1));
//Actor *ac1 = (Actor*
//Actor *ac2 = (Actor*)GetNamedObject(o2);
Actor *obj2 = dynamic_cast<Actor*>(GetNamedObject(o2));
Stone *st = dynamic_cast<Stone*>(GetNamedObject(o2));
if(!obj1) return ITEM_DROP;
if((!obj2)&&(!st)) return ITEM_DROP;
if (!world::HasRubberBand (obj1, obj2)) {
sound_event ("rubberband");
//world::KillRubberBand (sc.actor, (Stone*)0);
if(obj2)
world::AddRubberBand (obj1, obj2, strength, length);
else world::AddRubberBand (obj1, st, strength, length);
}
return ITEM_KILL;
}
public:
Rubberband() {
set_attrib("object1", Value());
set_attrib("object2", Value());
set_attrib("length", Value());
set_attrib("strength", Value());
}
};
DEF_TRAITS(Rubberband, "it-rubberband", it_rubberband);
}
---------------- CODE END ---------------------
hope this hepls.
greets
t.p.f.k.a.f.
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden:
http://mail.yahoo.de