我正在制作一个简单的打地鼠游戏作为我的第一个安卓迷你项目。我不知道该怎么做。我知道设置一切的基础知识等等,但我不知道如何为鼹鼠设置动画并制作它,以便当鼹鼠处于向上位置时可以轻敲它并计算一个点。我知道我可以做一个图像按钮并使计数器上升(计数器++),但我需要能够将帧从孔中的痣切换到向上位置的痣。我被告知要使用一种称为选择器的可绘制对象或某种 xml 动画,但我不太明白该怎么做。如果有人可以为我提供某种示例,我将不胜感激,或者如果有人能指出我正确的方向。谢谢!
问问题
2456 次
2 回答
0
我之前创建了一个简单的打鼹鼠游戏。为了便于查看,我将用项目符号格式写出来:
- First, you have to set a 3 cols and 4 rows table (depends on you).
- Place a picture of a hole in every cell, a total of 12 images.
- You have to place those images in an array.
- The logic is to create a timer and for every tick there's a for loop that reads the array.
- In each array, there's a random boolean generator.
- If it is true, change the picture in that array to a hole with a mole appearing
- If it is false, change the picture to a hole without a mole
- To sum it all up: Every tick, it will loop all the picture(array) and randomize each whether it's true or false. Depending on the value, the picture changes.
于 2012-08-31T09:21:48.563 回答