Back to project page TreeFrogEngine.
The source code is released under:
MIT License
If you think the Android project TreeFrogEngine listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.discretesoftworks.framework; /*from www . java2 s . com*/ // Controls camera position and possible movement public class View extends GriddedObject{ private float newX, newY, newZ; private float centerX, centerY, centerZ; private static final float baseZ = 5.5f; private float speed; public View(float x, float y, float z, float centerX, float centerY, float centerZ){ super(x,y,z); speed = 16; this.centerX = centerX; this.centerY = centerY; this.centerZ = centerZ; } public float getCenterX(){ return centerX; } public float getCenterY(){ return centerY; } public float getCenterZ(){ return centerZ; } public void setCenter(float cX, float cY, float cZ){ this.centerX = cX; this.centerY = cY; this.centerZ = cZ; } public void changeCenterX(float dcX){ centerX += dcX; } public void changeCenterY(float dcY){ centerY += dcY; } public void changeCenterZ(float dcZ){ centerZ += dcZ; } public float getBaseZ(){ return baseZ; } public float getViewScale(){ return getZ()/baseZ; } public void setNewX(float newX){ this.newX = newX; } public void setNewY(float newY){ this.newY = newY; } public void setNewZ(float newZ){ this.newZ = newZ; } public float getNewX(){ return newX; } public float getNewY(){ return newY; } public float getNewZ(){ return newZ; } public void setSpeed(float speed){ this.speed = speed; } public float getSpeed(){ return speed; } @Override public void setX(float x){ super.setX(x); setNewX(x); } @Override public void setY(float y){ super.setY(y); setNewY(y); } @Override public void setZ(float z){ super.setZ(z); setNewZ(z); } public void update(float deltaTime){ setX((newX+getX())/speed); setY((newY+getX())/speed); setZ((newZ+getZ())/speed); } }