/[enigma]/enigma/src/items.cc
ViewVC logotype

Diff of /enigma/src/items.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by mhawlisch, Wed Apr 2 09:56:39 2003 UTC revision 1.18 by mhawlisch, Fri Apr 4 10:07:33 2003 UTC
# Line 418  namespace Line 418  namespace
418  }  }
419    
420  //----------------------------------------  //----------------------------------------
421    // Springboard
422    //----------------------------------------
423    namespace
424    {
425        class Springboard : public Item {
426            CLONEOBJ(Springboard);
427        public:
428            Springboard() : Item("it-springboard") {}
429    
430            bool actor_hit(Actor *a) {
431                const double ITEM_RADIUS = 0.3;
432                px::V2 item_center(get_pos().x + 0.5, get_pos().y + 0.5);
433                double dist = length(a->get_pos()-item_center);
434                if (dist < ITEM_RADIUS) {
435                    set_anim("it-springboard_anim");                        
436                    SendMessage(a, "jump");
437                }
438                return false;
439            }
440    
441            void animcb() {
442                set_model("it-springboard");
443            }
444        };
445    }
446    
447    
448    //----------------------------------------
449  // Explosion  // Explosion
450  //----------------------------------------  //----------------------------------------
451  namespace  namespace
# Line 1152  namespace Line 1180  namespace
1180          void actor_enter(Actor *a) {          void actor_enter(Actor *a) {
1181              SendMessage(this, "crack");              SendMessage(this, "crack");
1182    
1183              if( get_type() < 3) {              if( get_type() <= 3) {
1184                  Item *it;                  Item *it;
1185                  GridPos p;                  GridPos p;
1186                    
# Line 1205  namespace Line 1233  namespace
1233          }          }
1234          void message(const string &msg, const Value &val) {          void message(const string &msg, const Value &val) {
1235              if (msg == "crack") {              if (msg == "crack") {
1236                  set_attrib("type", Value(int_attrib("type") + 1));                  set_attrib("type", Value(int_attrib("type") + 1));
1237                    play_sound("crack");
1238                  init_model();                  init_model();
1239              }              }
1240          }          }
# Line 1283  void items::Init() Line 1312  void items::Init()
1312      Register(new Spade);      Register(new Spade);
1313      Register(new Spring1);      Register(new Spring1);
1314      Register(new Spring2);      Register(new Spring2);
1315        Register(new Springboard);
1316      Register(new Sword);      Register(new Sword);
1317      Register(new TinyHill);      Register(new TinyHill);
1318      Register(new TinyHollow);      Register(new TinyHollow);

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26