原文地址:http://www.kilobolt.com/zombie-bird-tutorial-flappy-bird-remake.html
这个是教你怎么开发个僵尸鸟的。对我来说,我他喵才不想开发什么僵尸鸟。我只是打算研究一下libgdx。本来用AndEngine,可惜这货从上年就不更新了。
libgdx相对复杂一些,因为跨平台,因为用Gradle.所以,我就看看然后和大家分享分享经验。
首先,感谢伟大的libGDX。。。可以跨平台运行你的游戏。
Your game will run on iOS (iPhone and iPad), HTML (browsers), Android, Windows and Mac. You only have to write your code once in Java, thanks to libGDX.
你要是个JAVA新手。。去这里http://www.kilobolt.com/unit-1-beginning-java.html
僵尸鸟的全部程序代码https://github.com/sivvig/ZombieBird
老外开源就是diao。。。赞美开源精神~!
好了讲重点。
If you do not have Java installed on your machine, and you do not have Eclipse up and running with Android Development Tools, click here to install those.
首先,去装好ADT。
LibGDX offers cross-platform development that lets you write code once and run on multiple platforms. This is possible because in the ligGDX architecture, you have a core Java project in which you write all of your high-level source code (typically using some kind of interface). Whatever code you write in the core Java project will interface with platform-specific code via a variety of platform-specific Java projects (this is the core functionality offered by libGDX).
这段,解释了,为什么libgdx这么牛逼。一次编写,多平台运行,这个估计是由于它架构牛逼,一个核心的JAVA Project,然后你写一些接口。然后libgdx会帮你搞定平台适配。
1. Click here to Download the Setup App.
点击下载安装程序。
然后,我反正双击就直接运行了。
自己对应着设置一下。
6. Enter the information shown below (and in the image above): you may change the Destination to any folder you wish.
Name: ZombieBird //软件名字
Package: com.kilobolt.zombiebird //包名
Game class: ZBGame //游戏类
Destination: Your choice. Remember which folder you choose. //目标路径
Android SDK: The location of your Android SDK installation. If you are using the ADT Bundle (Android Developer Tools: Eclipse + Android SDK, etc.) this is located inside sdk inside the adt-bundle folder.
//SDK位置
7.选择高级 Advanced
选择Eclipse
作者选择无视Gradle 这个东西。因为太过复杂,如果你有编译Ant or Maven 的背景。可以去看看。这个以后再讨论
8。然后点Generate。我这个还提示了我的SDK版本比推荐的还高,我直接选继续。
9.开始下载了。。可以去一边上个厕所啥的了。。
10.。。等待时间超出预期。。。建议网速一般的话可以先去干别的,看个电影啥的。
11.失败了。。提示JAVA_HOME没找到。,然后第八条。。我手贱选什么,Yes,选NO才行。。。
12.OK了
BUILD SUCCESSFUL
Total time: 14.758 secs
Done!
To import in Eclipse: File -> Import -> Gradle -> Gradle Project
To import to Intellij IDEA: File -> Import -> build.gradle
To import to NetBeans: File -> Open Project...
13.导入文件到Eclipse。前面说过。。。这货是使用Gradle的。作者没考虑这个,就直接导入了。你可以按照他说的来。
嘛,我打算尝试一下装个Gradle
在Eclipse里面 http://dist.springsource.com/release/TOOLS/gradle
- In Eclipse Open Help >> Install New Software
- Paste a Gradle update site link into the "Work with" text box.
- Click the Add button at the top of the screen.
- Ensure that the option "Group Items by Category" is enabled.
- Select the top-level node ‘Extensions / Gradle Integration‘.
- Click "Next". This may take a while.
- Review the list of software that will be installed. Click "Next" again.
- Review and accept licence agreements and Click "Finish".
安装
呃。。。。好多问题。。先到这里了。我再研究研究。