src/proto2/Physics.hh
changeset 128 890ac82cdcc0
parent 123 7efb63402b2b
child 129 b1ae79a2d2f0
equal deleted inserted replaced
127:241830182118 128:890ac82cdcc0
    91      *
    91      *
    92      * @param pos Position vector
    92      * @param pos Position vector
    93      */
    93      */
    94     TerrainType getType(Vector pos) const;
    94     TerrainType getType(Vector pos) const;
    95 
    95 
       
    96     /**
       
    97      * Remove ground from the terrain. Removes a circle with given
       
    98      * radius.
       
    99      *
       
   100      * @param x center x coordinate
       
   101      * @param y center y coordinate
       
   102      * @param r circle radius
       
   103      */
    96     void removeGround(int x, int y, float r);
   104     void removeGround(int x, int y, float r);
       
   105     
       
   106     /**
       
   107      * Remove ground from the terrain. Removes a circle with given
       
   108      * radius.
       
   109      *
       
   110      * @param pos circle center
       
   111      * @param r circle radius
       
   112      */
    97     void removeGround(Vector pos, float r);
   113     void removeGround(Vector pos, float r);
    98 };
   114 };
    99 
   115 
   100 class PhysicsObject {
   116 class PhysicsObject {
   101 protected:
   117 protected:
   102     PhysicsWorld &world;
   118     PhysicsWorld &world;
   103     
   119     
   104     float mass;
   120     float mass;
   105     Vector position;
   121     Vector position;
   106     Vector velocity;
   122     Vector velocity;
   107     // Whether the object (worms mainly) is in the air 
   123     float aim; // Aim direction (half circle)
   108     // or firmly on the ground. Affects to physics.
   124     bool facingRight; // Player facing
   109     bool inAir;
   125     bool inAir; // Is the object "on the ground"
   110     float aim;
       
   111     uint8_t facing;
       
   112 
   126 
   113     // Shape of the object. We use a polygon with 4 edges
   127     // Shape of the object. We use a polygon with 4 edges
   114     // to make easy to draw with Clanlib. The coordinates
   128     // to make easy to draw with Clanlib. The coordinates
   115     // are relative to the center point.
   129     // are relative to the center point.
   116     std::vector<Vector> shape;
   130     std::vector<Vector> shape;