Package aspect.entity.behavior

Examples of aspect.entity.behavior.Behavior


        RigidBody rb = rigidBody();
       
        rb.vel = Vector2.fromAngle((float)Math.random() * 360, 200).asXY();
       
       
        addBehavior(new Behavior() {
            @Override
            public void update() {
                RigidBody rb = ent.rigidBody();
                if (ent.pos.x > getCanvasWidth() || ent.pos.x < 0) {
                    rb.vel.x *= -1;
View Full Code Here


            beam.transform.up = Vector3.yAxis();
            beam.transform.position = new Vector3(0.15f, 0.075f, -50.5f);
            beam.transform.position = new Vector3(0.15f, 0.075f, -50.5f);

            //turret.addChild(new Entity(beam));
            shooty = new Behavior() {
                @Override
                public void update() {
                    HashMap<Color, Entity> key = new HashMap<>();

                    if (isButtonDown(0)) {
View Full Code Here

        transform.position = pos;

        model.transform.scale = new Vector3(0.0f);

        addBehavior(new Behavior() {
            @Override
            public void update() {
                model.transform.scale.x += 8.0f * Time.deltaTime();
                model.transform.scale.y += 8.0f * Time.deltaTime();
                model.transform.scale.z += 8.0f * Time.deltaTime();
 
View Full Code Here

        addBehavior(new Billboard(model));
        addBehavior(new Motion(vel, Vector3.zero()));
        addBehavior(new TimeToLive(2.0f));

        addBehavior(new Behavior() {
            @Override
            public void update() {
                float f = 0.2f;
               
                if (source.thrust == 0.0f) {
View Full Code Here

        final Motion m = new Motion();
        m.velocity = new Vector3(0, 0, -5);
        addBehavior(m);

        if (leader == null) {
            flight = new Behavior() {
                @Override
                public void update() {
                    m.acceleration = transform.right().times(m.velocity.mag2() / radius);
                   
                    Vector3 vn = m.velocity.normalize();
View Full Code Here

        updateCounter();

        spawner = new Entity();
        spawner.transform.position.y = 15.0f;

        spawner.addBehavior(new Behavior() {
            private float timeUntilSpawn = 2.0f;

            @Override
            public void update() {
                timeUntilSpawn -= Time.deltaTime();

                if (timeUntilSpawn <= 0) {
                    float width = random.nextFloat() * 2.0f + 1.0f;
                    float height = random.nextFloat() * 2.0f + 1.0f;
                    float depth = random.nextFloat() * 2.0f + 1.0f;
                    final Entity entity = RigidBody.box(new Material(Color.random()), width, height, depth, 1.0f);

                    entity.addBehavior(new Behavior() {
                        @Override
                        public void update() {
                            if (entity.transform.position.y < -20.0f || isKeyDown(KEY_LCONTROL)) {
                                entity.destroy();
                                numBlocks--;
View Full Code Here

        controls[3] = new TurretControl(turret3);
        controls[4] = new TurretControl(turret4);
        controls[5] = new TurretControl(turret5);
        controls[6] = new TurretControl(turret6);
       
        addBehavior(new Behavior() {
            @Override
            public void update() {
                controls[control].ent = Frigate.this;
                controls[control].update();
            }
View Full Code Here

    private static final Timer fpsTimer = new Timer();
    private static final LinkedList<Behavior> keyListeners = new LinkedList<>();
    private static final LinkedList<Behavior> mouseListeners = new LinkedList<>();

    public static void main(String[] args) {
        run(800, 600, false, 60, new Behavior());
    }
View Full Code Here

        try {
            if (cons == null) {
                throw new NoSuchMethodException();
            }
            Behavior component = (Behavior) cons.newInstance(args);
            addBehavior(component);
        } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

    public void removeBehavior(Class c) {
        if (!Behavior.class.isAssignableFrom(c)) {
            return;
        }

        Behavior toRemove = null;

        for (Behavior cmpnt : behaviors) {
            if (c.isInstance(cmpnt)) {
                toRemove = cmpnt;
                break;
View Full Code Here

TOP

Related Classes of aspect.entity.behavior.Behavior

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.