• 小球游戏1


    引用:http://www.oschina.net/code/snippet_12_4121

    [图片] pic3.jpg

    [图片] pic4.jpg

    [代码] [Java]代码

    01 public class Player extends AnimatedSprite   {
    02 ...
    03 @Override
    04     protected void onManagedUpdate(final float pSecondsElapsed) {
    05         super.onManagedUpdate(pSecondsElapsed);
    06         onBeforePositionChanged();
    07     }
    08  
    09 private boolean onBeforePositionChanged(){
    10          
    11         //speed up
    12         if(frameCount < 2){
    13             frameCount++;
    14             return true;
    15         }
    16         frameCount = 0;
    17          
    18         int enemyListSize = levelController.getEnemyList().size();
    19         for(int i = 0; i < enemyListSize; i++)
    20             if(this.collidesWith(levelController.getEnemyList().get(i)))
    21             {
    22                 levelController.callbackCollisionEnemy();
    23                 return false;
    24             }
    25         for(int i = 0; i < levelController.getGoodsList().size(); i++)
    26             if(this.collidesWith(levelController.getGoodsList().get(i)))
    27             {
    28                 levelController.callbackCollisionGoods(i);
    29                 return false;
    30             }
    31  
    32         for(int i = 0; i < levelController.getEndPointList().size(); i++)
    33             if(this.collidesWith(levelController.getEndPointList().get(i)))
    34             {
    35                 levelController.callbackCollisionWithEndPoint();
    36                 return false;
    37             }
    38         return true;
    39     }
    40 ...
    41 }

    [文件] TheHardestGame.zip ~ 6MB    下载(453)

  • 相关阅读:
    C# 中ArrayList强制转化为数组【转】
    [转]rdlc和rdl的区别
    用EditPlus打造C#编程环境
    aspnet_wp.exe 未能启动
    手工打造C#IDE环境(一):万事开头难
    不让Hashtable排序
    Javascript实现把网页中table的内容导入到excel中的几种方法
    jQuery UI draggable+droppable+resizable+selectable+sortable
    CodeIgniter整理
    PHP文件 文件夹操作
  • 原文地址:https://www.cnblogs.com/sode/p/2186458.html
Copyright © 2020-2023  润新知