找回密码
 立即注册
LessonSnake48android | Unity3D 2022-10-29 114 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
布局方面:大家使用一个FrameLayout肯定定位,在里面放两个和父元素一样大的子元素。2、类设计方面:贪吃蛇游戏使用了三个主类和两个内部类。TitleView:一个游戏贴片(Tile)类,是大家的自定义View。是它实现游戏画面的贴片计算、贴片的品种定义、贴片的制作等和Tile相关的方法。SnakeView:是TileView的子类,是游戏的主体类。定义游戏状况、操作方法、游戏规则、初始化游戏、改写视图、管理打电话导致游戏暂停时保存状况,接收焦点时恢复状况等等工作都在这个类中进行,注意它仍是个View。MainActivity:游戏窗口类,担任载入SnakeView,为SnakeView服务。Snake.RefreshHandler:Handler类,改写ViewSnake.Coordinate:坐标类,简化问题。
Lesson48_Snake\bin\android\basic\lesson48\MainActivity.class
Lesson48_Snake\bin\android\basic\lesson48\R$attr.class
Lesson48_Snake\bin\android\basic\lesson48\R$drawable.class
Lesson48_Snake\bin\android\basic\lesson48\R$id.class
Lesson48_Snake\bin\android\basic\lesson48\R$layout.class
Lesson48_Snake\bin\android\basic\lesson48\R$string.class
Lesson48_Snake\bin\android\basic\lesson48\R.class
Lesson48_Snake\bin\android\basic\lesson48\SnakeView$Coordinate.class
Lesson48_Snake\bin\android\basic\lesson48\SnakeView$RefreshHandler.class
Lesson48_Snake\bin\android\basic\lesson48\SnakeView.class
Lesson48_Snake\bin\android\basic\lesson48\TileView.class
Lesson48_Snake\bin\classes.dex
Lesson48_Snake\bin\Lesson48_Snake.apk
Lesson48_Snake\bin\resources.ap_
Lesson48_Snake\gen\android\basic\lesson48\R.java
Lesson48_Snake\res\drawable\greenstar.png
Lesson48_Snake\res\drawable\icon.png
Lesson48_Snake\res\drawable\redstar.png
Lesson48_Snake\res\drawable\yellowstar.png
Lesson48_Snake\res\layout\main.xml
Lesson48_Snake\res\values\strings.xml
Lesson48_Snake\src\android\basic\lesson48\MainActivity.java
Lesson48_Snake\src\android\basic\lesson48\SnakeView.java
Lesson48_Snake\src\android\basic\lesson48\TileView.java
Lesson48_Snake\.classpath
Lesson48_Snake\.project
Lesson48_Snake\AndroidManifest.xml
Lesson48_Snake\default.properties
.....

(In terms of layout: we use a FrameLayout to position for sure, and put two child elements as big as the parent element in it. 2. Class design: The Snake game uses three main classes and two internal classes. TitleView: a game title class, which is your customized view. It refers to the methods related to Tile, such as the calculation of tiles, the definition of tiles, and the production of tiles. SnapView: It is a subclass of TileView and the main class of the game. Define the game status, operation methods, game rules, initialize the game, rewrite the view, manage the saved status when the game is paused due to a call, and recover the status when receiving the focus. Note that it is still a view. MainActivity: a game window class that serves as the loading and servicing of SnapeView. Snake. RefreshHandler: Handler class, rewrite ViewSnake. Coordinate: coordinate class to simplify the problem.
Lesson48_ Snake\bin\android\basic\lesson48\MainActivity.class
Lesson48_ Snake\bin\android\basic\lesson48\R$attr.class
Lesson48_ Snake\bin\android\basic\lesson48\R$drawable.class
Lesson48_ Snake\bin\android\basic\lesson48\R$id.class
Lesson48_ Snake\bin\android\basic\lesson48\R$layout.class
Lesson48_ Snake\bin\android\basic\lesson48\R$string.class
Lesson48_ Snake\bin\android\basic\lesson48\R.class
Lesson48_ Snake\bin\android\basic\lesson48\SnakeView$Coordinate.class
Lesson48_ Snake\bin\android\basic\lesson48\SnakeView$RefreshHandler.class
Lesson48_ Snake\bin\android\basic\lesson48\SnakeView.class
Lesson48_ Snake\bin\android\basic\lesson48\TileView.class
Lesson48_ Snake\bin\classes.dex
Lesson48_ Snake\bin\Lesson48_ Snake.apk
Lesson48_ Snake\bin\resources.ap_
Lesson48_ Snake\gen\android\basic\lesson48\R.java
Lesson48_ Snake\res\drawable\greenstar.png
Lesson48_ Snake\res\drawable\icon.png
Lesson48_ Snake\res\drawable\redstar.png
Lesson48_ Snake\res\drawable\yellowstar.png
Lesson48_ Snake\res\layout\main.xml
Lesson48_ Snake\res\values\strings.xml
Lesson48_ Snake\src\android\basic\lesson48\MainActivity.java
Lesson48_ Snake\src\android\basic\lesson48\SnakeView.java
Lesson48_ Snake\src\android\basic\lesson48\TileView.java
Lesson48_ Snake\.classpath
Lesson48_ Snake\.project
Lesson48_ Snake\AndroidManifest.xml
Lesson48_ Snake\default.properties
.....)

[下载]15474668741.rar




上一篇:Android手把手教你实现跳跃游戏
下一篇:自制的游戏开发基本架构