Package com.aqpproject.tools

Examples of com.aqpproject.tools.Vector2D


    }

    public void updateMiniature() {
        String current_map = m_mapsList.get(m_currentSelectedMap);
        m_worldEntities.get("preview").destroy();
        m_worldEntities.put("preview", new WEMenu("preview", m_spritesNameList.get(current_map), new Vector2D(m_minX + m_menuX + 50, m_minY + m_resolution.y - 400), 0, 1));
    }
View Full Code Here


        m_textActorName = name + "_info";
        m_playerName = playerName;
        m_powerDown = m_boost = false;
        m_lastFire = 0;
        m_lastStaticCollision = 0;
        m_sparklePosition = new Vector2D();
        m_lastContactPoint = new Vector2D();
        m_isStaticContact = false;
        m_isMyCar = false;
        m_lastTime = Singleton.getWorldModel().getTime();
        m_random = 0;
        m_sound = "defaut";
View Full Code Here

     * @see WorldEntity#update(long)
     */
    @Override
    public void update(long time) {
        super.update(time);
        int road = Singleton.getVisualisation().getTile(Visualisation.MAP_LAYER.ROAD, new Vector2D(m_position).translate(32, 0));
        //If out of the road
        if (road == 0) {
            Singleton.getPhysics().setDampling(m_name, m_linearDamping + 1.f, m_angularDamping);
            //DURT
            m_durt = Singleton.getPhysics().getLinearVelocity(m_name).length() > 50;
        } else {
            Singleton.getPhysics().setDampling(m_name, m_linearDamping, m_angularDamping);
            m_durt = false;
        }

        //Valeur de la variable random
        m_random = (int) (Singleton.getWorldModel().getTime() % 4);

        //Checkpoints
        int check = Singleton.getVisualisation().getTile(Visualisation.MAP_LAYER.INFORMATIONS, getCenter());
        if (check >= 15 && check <= 24) {
            check -= 15;
            m_checkpointManager.addCheckPoint(this, check);




        } // ITEMS
        else if (check == 14 && (Singleton.getWorldModel().getTime() - m_lastFire) > 200) {
            Vector2D tilePosition = new Vector2D();

            tilePosition.x = (float) ((Math.floor(getCenter().x / 64.f)) * 64);
            tilePosition.y = (float) ((Math.floor(getCenter().y / 64.f)) * 64);
            String name = "box_" + tilePosition.x + "_" + tilePosition.y;

View Full Code Here

    }

    @Override
    public void updateActorTransform() {
        super.updateActorTransform();
        Vector2D pos = Interpolation.getPositionInterpolation(m_oldPosition, m_position, Singleton.getWorldModel().getInterpolation());
        Singleton.getVisualisation().updateTextActor(m_textActorName, m_playerName, getCenter().x - 32, getCenter().y + 64);//pos.x+32, pos.y+64);

        Vector2D center = getCenter();

        if (m_powerDown) {
            Singleton.getVisualisation().setActorTeint(m_name, new Color(0, 1, 0, 1));
            Singleton.getVisualisation().updateParticleActor(m_name + "_smoke", center.x, center.y, true);
        } else if (m_boost) {
            center.translate(getDirection().scale(-32));
            Singleton.getVisualisation().updateParticleActor(m_name + "_smoke", center.x, center.y, true);
        } else {
            Singleton.getVisualisation().setActorTeint(m_name, new Color(1, 1, 1, 1));
        }

        center = getCenter();
        center.translate(getDirection().scale(-32));
        Singleton.getVisualisation().updateParticleActor(m_name + "_durt", center.x, center.y, m_durt);

        Singleton.getVisualisation().updateParticleActor(m_name + "_burn", center.x, center.y, m_shift && Singleton.getPhysics().getLinearVelocity(m_name).length() > 50);

        center = getCenter();
View Full Code Here

    @Override
    public void startContact(WorldPhysicEntity other, Vector2D normal, Vector2D point) {
        if (other instanceof WECar) {
            m_lastContactPoint = point;
            m_isStaticContact = false;
            Vector2D center = getCenter();
            m_sparklePosition = new Vector2D(point).translate(-center.x, -center.y);
            m_lastStaticCollision = Singleton.getWorldModel().getTime();
            if (m_isMyCar) {

                Singleton.getInput().setVibration(30000, 30000);
            }
View Full Code Here

    @Override
    public void startStaticContact(Vector2D normal, Vector2D point) {
        m_lastContactPoint = point;
        m_isStaticContact = true;

        Vector2D center = getCenter();
        m_sparklePosition = point.translate(-center.x, -center.y);
        m_lastStaticCollision = Singleton.getWorldModel().getTime();
    }
View Full Code Here

    public boolean getColliding() {
        return m_isColliding;
    }

    public void setSparklingPosition(Vector2D v, boolean isStatic) {
        Vector2D center = getCenter();
        if (isStatic) {
            m_sparklePosition = v;
        } else {
            m_sparklePosition = v.translate(-center.x, -center.y);
        }
View Full Code Here

    /**
     * Update the visualisation actor
     */
    public void updateActorTransform() {
        Vector2D pos = Interpolation.getPositionInterpolation(m_oldPosition, m_position, Singleton.getWorldModel().getInterpolation());
        float rot = Interpolation.getRotationInterpolation(m_oldRotation, m_rotation, Singleton.getWorldModel().getInterpolation());
        Singleton.getVisualisation().updateActor(m_name, pos.x, pos.y, rot);
        //Singleton.getVisualisation().updateActor(m_name, m_oldPosition.x,m_oldPosition.y,m_oldRotation);
    }
View Full Code Here

    /**
     * Return the direction of the entity
     */
    public Vector2D getDirection() {
        double rad = (Math.PI * m_rotation) / (180.0);
        return new Vector2D((float) Math.cos(rad), (float) Math.sin(rad)).normalize();
    }
View Full Code Here

        return new Vector2D((float) Math.cos(rad), (float) Math.sin(rad)).normalize();
    }

    public Vector2D getRight() {
        double rad = ((Math.PI * (m_rotation - 90))) / (180.0);
        return new Vector2D((float) Math.cos(rad), (float) Math.sin(rad)).normalize();
    }
View Full Code Here

TOP

Related Classes of com.aqpproject.tools.Vector2D

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.