Package com.artemis

Examples of com.artemis.Entity.addComponent()


import com.tankz.components.Velocity;

public class EntityFactory {
  public static Entity createExplosion(World world, float x, float y) {
    Entity e = world.createEntity();
    e.addComponent(new Transform(x, y));
    e.addComponent(new SpatialForm("explosion"));
    e.addComponent(new Expiration(200));
    e.addToWorld();
    return e;
  }
View Full Code Here


public class EntityFactory {
  public static Entity createExplosion(World world, float x, float y) {
    Entity e = world.createEntity();
    e.addComponent(new Transform(x, y));
    e.addComponent(new SpatialForm("explosion"));
    e.addComponent(new Expiration(200));
    e.addToWorld();
    return e;
  }
View Full Code Here

public class EntityFactory {
  public static Entity createExplosion(World world, float x, float y) {
    Entity e = world.createEntity();
    e.addComponent(new Transform(x, y));
    e.addComponent(new SpatialForm("explosion"));
    e.addComponent(new Expiration(200));
    e.addToWorld();
    return e;
  }

  public static Entity createBullet(World world, float x, float y, float angle, Entity shooter) {
View Full Code Here

  public static Entity createBullet(World world, float x, float y, float angle, Entity shooter) {
    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "bullets");
    Transform transform = new Transform(x, y, angle);
    e.addComponent(transform);
    e.addComponent(new SpatialForm("bullet"));
    e.addComponent(new Expiration(1500));

    Body b = new Body(new Box(10, 10), 0.2f);
    b.setUserData(e);
View Full Code Here

  public static Entity createBullet(World world, float x, float y, float angle, Entity shooter) {
    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "bullets");
    Transform transform = new Transform(x, y, angle);
    e.addComponent(transform);
    e.addComponent(new SpatialForm("bullet"));
    e.addComponent(new Expiration(1500));

    Body b = new Body(new Box(10, 10), 0.2f);
    b.setUserData(e);
    b.addExcludedBody(shooter.getComponent(Physics.class).getBody());
View Full Code Here

    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "bullets");
    Transform transform = new Transform(x, y, angle);
    e.addComponent(transform);
    e.addComponent(new SpatialForm("bullet"));
    e.addComponent(new Expiration(1500));

    Body b = new Body(new Box(10, 10), 0.2f);
    b.setUserData(e);
    b.addExcludedBody(shooter.getComponent(Physics.class).getBody());
    b.setBitmask(1);
View Full Code Here

    // b.setDensity(100);
    // b.setFriction(1.1f);
    // b.setDamping(0.002f);
    // b.setRestitution(0);

    e.addComponent(new Physics(b));

    e.addToWorld();

    return e;
  }
View Full Code Here

  public static Entity createWall(World world, float x, float y) {
    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "walls");

    SpatialForm form = new SpatialForm("wall");
    e.addComponent(form);

    Body b = new Body(new Box(214, 214), 0.3f);
    b.setMoveable(false);
    b.setRotatable(false);
    b.setUserData(e);
View Full Code Here

    b.setPosition(x, y);
    b.setDamping(0.1f);
    b.setRestitution(0);
    b.setRotDamping(10f);
    b.setFriction(100);
    e.addComponent(new Physics(b));

    e.addToWorld();

    return e;
  }
View Full Code Here

  }

  public static Entity createCrate(World world, float x, float y, float angleDeg) {
    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "crates");
    e.addComponent(new Health(100, 160));

    SpatialForm form = new SpatialForm("crate");
    e.addComponent(form);

    Body b = new Body(new Box(50, 50), 0.3f);
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.