【问题标题】:How would I do this?(Android Whack-A-Mole)我该怎么做?(Android Whack-A-Mole)
【发布时间】:2012-04-18 19:25:43
【问题描述】:

我正在制作一个简单的打地鼠游戏,作为我的第一个 Android 迷你项目。我不知道该怎么做。我知道设置一切的基础知识等等,但我不知道如何为鼹鼠制作动画并制作它,以便当鼹鼠处于向上位置时可以轻敲它并计算一个点。我知道我可以做一个图像按钮并使计数器上升(计数器++),但我需要能够将帧从孔中的痣切换到向上位置的痣。有人告诉我要使用一种称为选择器的可绘制对象或某种 xml 动画,但我不太明白该怎么做。如果有人可以为我提供某种示例,我将不胜感激,或者如果有人能指出我正确的方向。谢谢!

【问题讨论】:

    标签: android xml animation selector drawable


    【解决方案1】:

    使用游戏引擎。两个最受欢迎的(在我看来)引擎是AndEngineLibGDX。前者更适合初学者,是一个完整的引擎,而后者更适合中高级开发人员的框架。

    【讨论】:

      【解决方案2】:

      我之前创建了一个简单的打鼹鼠游戏。为了方便查看,我会以项目符号的形式写出来:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-16
        • 2012-05-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-23
        相关资源
        最近更新 更多