Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

move.cc

Go to the documentation of this file.
00001 #include "move.hh"
00002 #include "register.hh"
00003 #include "abstractworld.hh"
00004 
00005 namespace anoid {
00006     namespace plugin {
00007 
00008         using namespace simple;
00009         using namespace config;
00010 
00011         void Move::init(Configuration &c) {
00012             movement = c.getVector("movement");
00013             Position::init(c);
00014             registerName("Move");
00015 
00016             getWorld()->listen(parentElement->getShape(), "CollisionMessage");
00017         }
00018 
00019         Vector Move::getMovement() {
00020             return movement;
00021         }
00022 
00023         void Move::setPosition(Vector &p) {
00024             position = p;
00025         }
00026 
00027         void Move::setMovement(Vector &m) {
00028             movement = m;
00029         }
00030 
00031         void Move::update() {
00032             oldPosition = position;
00033             position += getMovement();
00034             Position::update();
00035         }
00036 
00037         Register(Move)
00038 
00039     };
00040 };

Anoid NG © Michael Westergaard, Martin Stig Stissing, Ronni Michael Laursen, and Kristian Bisgaard Lassen