Package com.tankz.components

Examples of com.tankz.components.Transform


    velocityMapper = world.getMapper(Velocity.class);
  }

  @Override
  protected void process(Entity e) {
    Transform t = transformMapper.get(e);
    Velocity velocity = velocityMapper.get(e);

    float r = t.getRotationAsRadians();
    float v = velocity.getVelocity();

    float xn = t.getX() + (TrigLUT.cos(r) * v * world.getDelta());
    float yn = t.getY() + (TrigLUT.sin(r) * v * world.getDelta());

    t.setLocation(xn, yn);
  }
View Full Code Here


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 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);
View Full Code Here

TOP

Related Classes of com.tankz.components.Transform

Copyright © 2018 www.massapicom. 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.