我该怎么做?(安卓Whack-A-Mole)



我正在制作一个简单的打地鼠游戏,作为我的第一个android迷你项目。我不知道该怎么办。我知道设置所有东西的基本知识,但我不知道如何设置鼹鼠的动画并制作它,以便当鼹鼠处于向上位置时,可以敲击它并计算一个点。我知道我可以做一个图像按钮,并让计数器向上(计数器++),但我需要能够将帧从孔中的鼹鼠切换到向上位置的鼹鼠。有人告诉我要使用一种叫做选择器的可绘制文件或某种xml动画,但我不太明白如何做到这一点。如果有人能给我提供一个这样的例子,我将不胜感激,或者有人能为我指明正确的方向。谢谢

使用游戏引擎。两个最流行的(在我看来)引擎是AndEngine和LibGDX。前者更适合初学者,是一个完整的引擎,而后者更适合中级到高级开发人员。

我以前创建过一个简单的打地鼠游戏。我将用项目符号格式写这篇文章,以便查看:

- 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.

最新更新