当前位置: 首页>>代码示例>>Java>>正文


Java PApplet.round方法代码示例

本文整理汇总了Java中processing.core.PApplet.round方法的典型用法代码示例。如果您正苦于以下问题:Java PApplet.round方法的具体用法?Java PApplet.round怎么用?Java PApplet.round使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在processing.core.PApplet的用法示例。


在下文中一共展示了PApplet.round方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updatePos

import processing.core.PApplet; //导入方法依赖的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;
       }

    }


 }
 
开发者ID:Error1000,项目名称:processingGameEngine,代码行数:64,代码来源:Camera.java

示例2: render

import processing.core.PApplet; //导入方法依赖的package包/类
@Override
public void render(){
	getGame().background(255);
	if(t == PApplet.map(WINDOW_HEIGHT, 400, 900, 28, 46)*PApplet.round(getGame().frameRate) )exit();



t++;
}
 
开发者ID:Error1000,项目名称:processingGameEngine,代码行数:10,代码来源:EndGUI.java


注:本文中的processing.core.PApplet.round方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。