【问题标题】:Android Animation Help!Android动画帮助!
【发布时间】:2011-04-27 22:10:29
【问题描述】:

(我是 android 的初学者,所以请客气!)

我正在为我的 Android 手机制作游戏,我希望将位图图像从屏幕顶部移动到底部。我一直在使用画布将图像绘制到屏幕上,我只是不知道如何让它移动。

public void playerShip(Canvas canvas)
    {
        canvas.drawBitmap(chosenShip, x, y, painter);
    }

这听起来很简单,但我不知疲倦地在网上搜索教程或示例,但无济于事。我希望有人能提供帮助。

【问题讨论】:

    标签: android


    【解决方案1】:

    建议作为 android 初学者编写游戏,因为编写游戏,取决于您使用的游戏类型、风格和工具可能非常棘手。

    如果你在屏幕上移动位图,Android 会提供一个用于翻译的 API,它会改变对象的位置。在这里查看:

    http://developer.android.com/reference/android/view/animation/Animation.html

    请记住,如果您的图像是 imageview,那么这将被视为一个视图,并且可以对其应用动画。

    您可以使用的其他参考资料:

    http://developer.android.com/guide/topics/graphics/2d-graphics.html

    http://stuffthathappens.com/blog/2008/11/13/android-animation-101/

    http://mylifewithandroid.blogspot.com/2008/04/animated-views.html

    http://www.droidnova.com/2d-sprite-animation-in-android,471.html

    我希望这会有所帮助。

    【讨论】:

    • 好的,谢谢您的建议!我会研究 TranslationAnimations...希望这足以满足我的需要!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-27
    • 1970-01-01
    • 2011-03-14
    • 2011-08-28
    • 2010-10-07
    • 1970-01-01
    相关资源
    最近更新 更多