首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我该怎么做呢?(Android Whack A-Mole)

我该怎么做呢?(Android Whack A-Mole)
EN

Stack Overflow用户
提问于 2012-04-05 11:00:09
回答 2查看 2.4K关注 0票数 0

我正在制作一个简单的打地鼠游戏,作为我在android上的第一个迷你项目。我不知道该怎么做。我知道设置一切的基础知识之类的,但是我不确定如何使这些老鼠动起来,这样当老鼠处于向上的位置时,它就可以被轻击并计算一个点。我知道我可以做一个图像按钮和一个计数器上升(counter++),但我需要能够切换帧从洞中的老鼠到上方位置的老鼠。有人告诉我要使用一种称为选择器的可绘制图形或某种xml动画,但我不太明白该怎么做。如果有人能为我提供某种形式的例子,或者有人能给我指明正确的方向,我将不胜感激。谢谢!

EN

回答 2

Stack Overflow用户

发布于 2012-04-05 11:03:44

使用游戏引擎。在我看来,最流行的两个引擎是AndEngineLibGDX。前者更多地面向初学者,是一个完整的引擎,而后者则更多地是一个面向中级到高级开发人员的框架。

票数 1
EN

Stack Overflow用户

发布于 2012-08-31 17:21:49

我之前已经创建了一个简单的打地鼠游戏。为了便于查看,我将以项目符号格式编写此代码:

代码语言:javascript
复制
- 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.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10022105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档