示例#1
0
  Vec vec_by_mouse(int x, int y) {
    Vec ans = new Vec();
    ans.x = (x - dim.width / 2.) / size;
    ans.y = -(y - dim.height / 2.) / size;

    return ans;
  }
示例#2
0
 Vec wall_power(Ball p) {
   Vec ans = new Vec();
   is_colide = false;
   ans.x = wall_power2(p.pos.x);
   ans.y = wall_power2(p.pos.y);
   if (is_colide) ans.sub_to(p.speed.mult(10));
   return ans;
 }
示例#3
0
 Vec mult(double scalar) {
   Vec ans = new Vec();
   ans.x = x * scalar;
   ans.y = y * scalar;
   return ans;
 }
示例#4
0
 Vec sub(Vec right) {
   Vec ans = new Vec();
   ans.x = x - right.x;
   ans.y = y - right.y;
   return ans;
 }
示例#5
0
 Vec add(Vec right) {
   Vec ans = new Vec();
   ans.x = x + right.x;
   ans.y = y + right.y;
   return ans;
 }
示例#6
0
 Vec div(double a) {
   Vec ans = new Vec();
   ans.x = x / a;
   ans.y = y / a;
   return ans;
 }