Package com.sertaogames.cactus2d

Examples of com.sertaogames.cactus2d.GameObject.AddComponent()


    GameObject gameObject = new GameObject("Objeto");
   
    Texture tx = Cactus2DApplication.loadTexture("data/textures/allTextures.png", true);
    SpriteRendererComponent sr = SpriteRendererComponent.getTextureRegion(tx,width, heigth, j, i);

    gameObject.AddComponent(sr);

    Utils.offsetCorrection(initialPosition);
    DragAndDropComponent dd = new DragAndDropComponent();
    gameObject.transform.getLocalPosition().set(new Vector2(initialPosition).sub(new Vector2(sr.spriteRegion.getRegionWidth()/2
        ,sr.spriteRegion.getRegionHeight()/2)));
View Full Code Here


    Utils.offsetCorrection(initialPosition);
    DragAndDropComponent dd = new DragAndDropComponent();
    gameObject.transform.getLocalPosition().set(new Vector2(initialPosition).sub(new Vector2(sr.spriteRegion.getRegionWidth()/2
        ,sr.spriteRegion.getRegionHeight()/2)));
    gameObject.AddComponent(dd);
    gameObject.AddComponent(new AudioComponent("data/sound/drag.wav"));
    gameObject.AddComponent(new MyHomeComponent());
   
    addDinamicPhysicBySprite(gameObject);
    return gameObject;
View Full Code Here

    Utils.offsetCorrection(initialPosition);
    DragAndDropComponent dd = new DragAndDropComponent();
    gameObject.transform.getLocalPosition().set(new Vector2(initialPosition).sub(new Vector2(sr.spriteRegion.getRegionWidth()/2
        ,sr.spriteRegion.getRegionHeight()/2)));
    gameObject.AddComponent(dd);
    gameObject.AddComponent(new AudioComponent("data/sound/drag.wav"));
    gameObject.AddComponent(new MyHomeComponent());
   
    addDinamicPhysicBySprite(gameObject);
    return gameObject;
  }
View Full Code Here

    DragAndDropComponent dd = new DragAndDropComponent();
    gameObject.transform.getLocalPosition().set(new Vector2(initialPosition).sub(new Vector2(sr.spriteRegion.getRegionWidth()/2
        ,sr.spriteRegion.getRegionHeight()/2)));
    gameObject.AddComponent(dd);
    gameObject.AddComponent(new AudioComponent("data/sound/drag.wav"));
    gameObject.AddComponent(new MyHomeComponent());
   
    addDinamicPhysicBySprite(gameObject);
    return gameObject;
  }
View Full Code Here

  public static GameObject createBackground() {
    GameObject gameObject = new GameObject("background");
   
    Texture tx = Cactus2DApplication.loadTexture("data/textures/allTextures.png", true);
    SpriteRendererComponent sr = SpriteRendererComponent.getTextureRegion(tx,600, 1024, 0, 0);
    gameObject.AddComponent(sr);
    Utils.offsetCorrection(gameObject.transform.getLocalPosition());
    return gameObject;
  }

  private static void addStaticPolignPhysic(GameObject go, Vector2 dimensions, Vector2 location) {
View Full Code Here

  private static void addStaticPolignPhysic(GameObject go, Vector2 dimensions, Vector2 location) {
    GameObject side = new GameObject("side");

    PhysicsComponent p = new PhysicsComponent(1, false, false);
    side.AddComponent(p);
   
    side.transform.getLocalPosition().set(location);
    Vector2 offset = new Vector2(dimensions).mul(0.5f);
    BoxCollider coll = new BoxCollider(dimensions, offset);
    side.AddComponent(coll);
View Full Code Here

    side.AddComponent(p);
   
    side.transform.getLocalPosition().set(location);
    Vector2 offset = new Vector2(dimensions).mul(0.5f);
    BoxCollider coll = new BoxCollider(dimensions, offset);
    side.AddComponent(coll);
   
    go.addGameObject(side);
  }

View Full Code Here


  public static GameObject createController() {
    GameObject controller = new GameObject("Controller");
   
    controller.AddComponent(new GameControllerComponent());
    controller.transform.getLocalPosition().set(10, 600);
    Utils.offsetCorrection(controller.transform.getLocalPosition());
    return controller;
  }
 
View Full Code Here

    int width = 512;
    Texture tx = Cactus2DApplication.loadTexture("data/textures/gui.png", true);
    SpriteRendererComponent sr = SpriteRendererComponent.getTextureRegion(tx ,width, height, 1, 1);
    sr.layer = 2;
    sr.gui = true;
    tip.AddComponent(sr);

    float halfWidth = width * Cactus2DApplication.invCameraZoom / 2;

    tip.transform.getPosition().set(Gdx.graphics.getWidth() / 2 - halfWidth, Gdx.graphics.getHeight() / 2 - height * Cactus2DApplication.invCameraZoom / 2);

View Full Code Here

    label.transform.getPosition().set(halfWidth, 400 * Cactus2DApplication.invCameraZoom);
    tip.addGameObject(label);
   
    GameObject subGameObject = new GameObject("Continue");
    subGameObject.transform.getLocalPosition().add(width * 0.7f* Cactus2DApplication.invCameraZoom, 0);
    subGameObject.AddComponent(new SpriteRendererComponent(null));
    subGameObject.spriteRenderer.gui = true;
    TextureRegion[][] tmp = TextureRegion.split(tx, 128, 128);
    subGameObject.AddComponent(new ButtonComponent(tmp[0][0], tmp[0][1]));
    subGameObject.AddComponent(new AudioComponent("data/sound/click.wav"));
    subGameObject.AddComponent(new NextstateComponent(newState));
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.