java round指令_Java PApplet.round方法代码示例
import processing.core.PApplet; //導(dǎo)入方法依賴的package包/類
public static final void updatePos() {
if(following && (followedGameObject != null)) {
posToGo.set(followedGameObject.loc);
posToGo.x = PApplet.round(posToGo.x);
posToGo.y = PApplet.round(posToGo.y);
}
getGame().translate(-(camLoc.x-WINDOW_WIDTH/2),-(camLoc.y-WINDOW_HEIGHT/2));
switch(fancy) {
case 3:
//Note: This is the default which is move only when outside the window and try to keep the y position in the middle
fancyOption3();
break;
case 2:
//Note: This option always follows the entity even if it is or not outside the bounds but it also tries to keep the y position in the middle
fancyOption2();
break;
case 1:
//Note: This option follows the entity no matter what
fancyOption1();
break;
case 0:
//Note: This option follows the entity when outside bounds but dosen't try to keep the y position in the middle
fancyOption0();
break;
default:
fancyOption3();
break;
}
if(goToTarget){
//Adding a nice little speedup/speeddown effect
if(posToGo.x - camLoc.x*-1 < -120) {
camSpeed -= speedDown;
}else{
camSpeed += speedUp;
}
}else{
//Resetting cam speed once we reached the point
if((int)camSpeed != (int) cSB) {
if(camSpeed > cSB)
camSpeed -=0.5f;
else
camSpeed +=0.5f;
}else{
camSpeed = cSB;
}
}
}
總結(jié)
以上是生活随笔為你收集整理的java round指令_Java PApplet.round方法代码示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java final 变量 回收_在Ja
- 下一篇: java web 播放音频_使用Java