基于Angle游戏引擎相关的文档说明
来源:互联网 发布:网络歌曲我想静静 编辑:程序博客网 时间:2024/05/29 16:06
Android上的游戏引擎中,Angle是其中之一,觉得其小巧玲珑,故下面对其进行简而概之的进行相关的说明。
/** *下面的飞机是继承精灵类 */class MyShip extends AngleSprite{AngleVector mDestination;//时刻控制飞机的位置float Speed; //对应的飞机的速度public MyShip(AngleSpriteLayout sprite){super(sprite);mPosition.set(160,240);//默认的初始的位置mDestination=new AngleVector(mPosition); Speed=200;}@Overridepublic void step(float secondsElapsed){ //不断的将当前的飞机的位置接近最终的目标的位置 if ((int)mPosition.mX<(int)mDestination.mX)mPosition.mX+=Speed*secondsElapsed;if ((int)mPosition.mX>(int)mDestination.mX)mPosition.mX-=Speed*secondsElapsed;if ((int)mPosition.mY<(int)mDestination.mY)mPosition.mY+=Speed*secondsElapsed;if ((int)mPosition.mY>(int)mDestination.mY)mPosition.mY-=Speed*secondsElapsed;super.step(secondsElapsed);}}class MyShot extends AngleSprite { public MyShot(MyShip ship, AngleSpriteLayout layout) { super(layout); //初始化子弹的位置 mPosition.set(ship.mPosition.mX, ship.mPosition.mY - 20); } @Override public void step(float secondsElapsed) { //默认的速度是300 mPosition.mY -= 300 * secondsElapsed; if (mPosition.mY < -10) mDie=true; super.step(secondsElapsed); } };public MyDemo(AngleActivity activity) { super(activity); //Create and insert two main object groups. One for the game field and other for the dashboard //>Creamos e insertamos dos grupos de objetos principales. Uno para el campo de juego y otro para los marcadores ogField=addObject(new AngleObject()); ogDashboard=addObject(new AngleObject()); //Create a tile bank and a tile map for the ground (see constructors) //>Creamos un banco de tiles y un mapa para el suelo (mirar los constructores) AngleTileBank tbGround = new AngleTileBank(mActivity.mGLSurfaceView,R.drawable.tilemap,4,4,32,32); tmGround = new AngleTileMap(tbGround, 320, 480, 15, 100, false,false); for (int t=0;t<tmGround.mColumnsCount*tmGround.mRowsCount;t++) tmGround.mMap[t]=(int) (Math.random()*tbGround.mTilesCount); // Put the bottom of the camera at the lowest part of the map //>Ponemos la c醡ara en la parte m醩 baja del mapa tmGround.mTop = tmGround.mRowsCount* tbGround.mTileHeight - tmGround.mHeight; ogField.addObject(tmGround); slShip = new AngleSpriteLayout(mActivity.mGLSurfaceView,64, 64, R.drawable.anglelogo, 0, 0, 128, 128); slShot = new AngleSpriteLayout(mActivity.mGLSurfaceView,16, 16, R.drawable.anglelogo, 0, 0, 128, 128); mShip = (MyShip)ogField.addObject(new MyShip(slShip)); mOtherShip = (MyShip)ogField.addObject(new MyShip(slShip)); //The dashboard background //>Fondo de los marcadores AngleSpriteLayout slDash = new AngleSpriteLayout(mActivity.mGLSurfaceView, 320, 64, R.drawable.tilemap, 0, 32, 320, 64); AngleSprite mDash=(AngleSprite)ogDashboard.addObject(new AngleSprite (slDash)); mDash.mPosition.set(160, 480-slDash.roHeight/2); mDash.mAlpha=0.5f; //Font and text //>Fuente y texto AngleFont fntCafe25 = new AngleFont(mActivity.mGLSurfaceView, 25, Typeface.createFromAsset(getAssets(),"cafe.ttf"), 222, 0, 0, 30, 200, 255, 255); ogDashboard.addObject(new AngleString(fntCafe25,"I Like The 2D Game Development Very Much~~",160,440,AngleString.aCenter)); }
从上面来看 真个游戏引擎是比较简单的
但是游戏引擎简单,需要克服的问题存在的
就是 创建地图的时候才,从上面的代码中可以看出 是直接创建100行的地图 ,但是如果创建更多,在手机上吃不消的,故需要一种很好的缓存的策略。
- 基于Angle游戏引擎相关的文档说明
- Android游戏引擎-Angle
- Android 游戏引擎——Angle
- 利用Android游戏引擎Angle开发界面
- Android开源游戏引擎之Angle
- 基于opengl的游戏引擎
- 关于基于 Apache Mahout 构建社会化推荐引擎”调试的相关说明
- 基于java的开源游戏引擎
- 基于Web的3D游戏引擎
- 基于HTML5的战棋游戏引擎
- 基于WiEngine游戏引擎的Sample
- 基于Unity3d 引擎的Android游戏优化
- 基于Unity3d 引擎的Android游戏优化
- 基于Unity3d 引擎的Android游戏优化
- 基于Unity3d 引擎的Android游戏优化
- 基于Unity3d 引擎的Android游戏优化
- 基于Unity3D引擎的Android游戏优化
- 基于Unity3d 引擎的Android游戏优化
- ffmpeg教程
- Tomcat部署web项目
- Java WEB开发中路径问题的总结
- torrent文件分析
- shell中nice函数
- 基于Angle游戏引擎相关的文档说明
- 第一次在csdn上开篇 因为我还是菜鸟
- 结构型模式:Decorator(装饰)
- 二级指针的两种用法
- SIPp安装配置
- cocos2d-x for android:ubuntu 环境搭建
- firefox os架构
- sysctl命令详解
- JSP内置对象之response对象