Examples of PhysicalShape


Examples of com.google.gwt.maeglin89273.game.ashinyballonthecross.client.core.creation.shape.PhysicalShape

      double angle=lastShapesCount*PORTION_ANGLE;
      Point pos=this.position.clone();
      pos.translate(new Vector(spoutDistance,angle,true));
      Vec2 impulse=new Vec2((float)(this.impulseMag*Math.cos(angle)),(float)(this.impulseMag*Math.sin(angle)));
     
      PhysicalShape shape=generateShape(pos,angle);
      if(shape.isVerified()){
        shape.getBody().applyLinearImpulse(impulse,shape.getBody().getWorldCenter());
        lastShapesCount--;
      }else{
        if(lastShapesCount==15){
          controller.destroy();
        }
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.ashinyballonthecross.client.core.creation.shape.PhysicalShape

  private ShapesLine(Point p1, Point p2,ShapesLineDefiner.ShapeDefiner[] shapeSketches,int count) {
    super( 0,false, p1, p2);
   
    ShapesLineDefiner.ShapeDefiner shapeDefiner;
    PhysicalShape shape;
    ShapesController controller=new ShapesController();
    for(int i=0;i<count;i++){
      shapeDefiner=shapeSketches[i];
      if(shapeDefiner instanceof ShapesLineDefiner.CircleDefiner){
        shape=new Circle(controller,shapeDefiner.getPosition(),((ShapesLineDefiner.CircleDefiner)shapeDefiner).getRadius(),shapeDefiner.getColor());
      }else if(shapeDefiner instanceof ShapesLineDefiner.RectangleDefiner){
        shape=new Rectangle(controller,shapeDefiner.getPosition(),shapeDefiner.getAngle(),((ShapesLineDefiner.RectangleDefiner)shapeDefiner).getWidth(),((ShapesLineDefiner.RectangleDefiner)shapeDefiner).getHeight(),shapeDefiner.getColor());
      }else{
        shape=new Polygon(controller,shapeDefiner.getPosition(),shapeDefiner.getAngle(),((ShapesLineDefiner.PolygonDefiner)shapeDefiner).getVertices(),shapeDefiner.getColor());
      }
      if(!shape.isVerified()){
        if(i==0)
          controller.destroy();
        break;
      }
    }
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.ashinyballonthecross.client.core.creation.shape.PhysicalShape

    timer=new RepeatingTimer(new TimerTask(){

      @Override
      public void doTask() {
       
        PhysicalShape shape;
        switch(Random.nextInt(3)){
        case 0:
          shape=new Circle(position);
          break;
        case 1:
          shape=new Rectangle(position);
          break;
        default:
          shape=new Polygon(position);
        }
        shape.getBody().applyLinearImpulse(impulse, shape.getBody().getWorldCenter());
      }
     
    }, 500);
    timer.start();
  }
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.ashinyballonthecross.client.core.creation.shape.PhysicalShape

   * @see com.google.gwt.maeglin89273.game.mengine.page.Page#update()
   */
  @Override
  public void update() {
    if(mousePressed){
      PhysicalShape shape=null;
      /*switch(Random.nextInt(3)){
        case 0:*/
          shape=new Circle(MEngine.getMousePosition());
          /*break;
        case 1:
          shape=new Rectangle(MEngine.getMousePosition());
          break;
        case 2:
          shape=new Polygon(MEngine.getMousePosition());
         
      }*/
      shape.getBody().applyLinearImpulse(new Vec2(0,-1), shape.getBody().getWorldCenter());
    }
   
    worldLayer.update();
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.