}
此外还定义了updateWalls()、updateApples()、updateSnake()绘制墙、果子、蛇,以及更新画面函数、保存位置坐标函数等,具体代码请详见目录。
4.3界面设计
界面设计包括游戏主界面(Snake)、游戏说明界面、游戏界面的设计。界面的设计采用的是xml文档形式,在xml文档中规划好界面布局布局后,分别在java文件中声明。
主界面设计:主界面包括一个 TextView及布局设定,其main.xml文档如下
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project
you may not use this file except in compliance with the License. You may obtain a copy of the License at
/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
android:layout_width="match_parent" android:layout_height="match_parent">
<com.example.android.snake.SnakeView android:id="@+id/snake"
android:layout_width="match_parent"
android:layout_height="match_parent" tileSize="24" />
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库安卓贪吃蛇课程设计报告(15)在线全文阅读。
相关推荐: