什么是制作这个动画的最佳解决方案?

huangapple go评论69阅读模式
英文:

What would be the best solution to making this animation

问题

我试图制作一个游戏,其中包含多个关卡,您需要找到一种方法,使特定颜色通过显示在屏幕上的管道。这些管道的外观类似于什么是制作这个动画的最佳解决方案?(仅作为参考,实际应更为精细)。因此,基本上应该有一个颜色沿着这些管道向下移动的动画(每个管道使用不同的颜色)。现在,我可以制作一个gif并将其用作我的动画,但文件太大了(大约5MB,虽然不多,但如果有数十个关卡,文件会逐渐增多)。有什么解决方案是最有效的?

英文:

I am trying to make a game where you have multiple levels where you have to figure out a way to where a certain color should go through pipes that are displayed on the screen. The pipes look like 什么是制作这个动画的最佳解决方案? (it all should be better, but just as a reference). So basically there should be an animation of color going down these pipes (different color for different pipe). Now, I can make a gif and use that as my animation, but it's just too large (aprox. 5MB, which isn't a lot, but if you put dozens of levels, it tends to add up).What would be a solution that would be the most efficient?

答案1

得分: 0

你尝试过使用drawRect()或drawCircle()吗?你只需要起始点、转折点和结束点的坐标。用一个带有延迟的递归函数进行绘制,效果应该不错。

英文:

Have you tried using the drawRect() or drawCircle()? You only need coordinations of the starting point, the turning points, and the ending point. Draw it with a recursive function with delay, and it should look good.

答案2

得分: 0

我首先建议您选择Unity进行游戏开发。
如果不选择Unity,可以尝试cocos2d或其他任何框架。
其次,如果您想使用本地代码来实现动画效果,可以尝试使用Canvas的draw()函数(正如@Wakeman所建议的)进行实验。
现在针对您的问题,如果您的游戏不涉及连续的用户交互,并且您考虑将GIF用作解决方案,那么我建议您使用**Lottie库**。
您可以在Adobe After Effects中创建精美的动画,并将这些动画(json文件)导入到Android中,不会对内存造成太大的负担,同时可以获得高分辨率的输出。

英文:

Well I would first recommend you to go with Unity for Game Development.
If not then check out cocos2d or any other frameworks.
Secondly, if you want to animate things using the native code, then play around with draw() functions (as suggested by @Wakeman) of the Canvas.
Now coming to your question, if your game does not involve continuous user interaction and you are thinking of GIFs as a solution then I would recommend using Lottie library.
You can create beautiful animations in Adobe After Effects and import those (json files) in Android without hurting much memory, plus would get high resolution output.

答案3

得分: 0

以下是您要翻译的内容:

更好的方法是将您的关卡构建为瓦片地图。每个管道段可以由数字编码,并绘制为位图(精灵),具体绘制取决于其状态(空白、1/4、1/3、1/2 或满)。类似的原理适用于像Unity/Cocos 2D或您自己的渲染引擎之类的引擎。这种构建关卡的方式,在大小上要比全屏动画轻上数百倍,并且可以在不同关卡中多次重复使用。

什么是制作这个动画的最佳解决方案?

英文:

It would be better to construct your levels as tilemap. Every segment of pipe can be coded by number and drawn as bitmap (Sprite) that depends on its state (empty, 1/4, 1/3, 1/2 or full). Similar principles works for engines like Unity/Cocos 2D or your own renderer. This way of building your levels would be hundred times lighter in size than full screen animation and used multiple times for different levels.

什么是制作这个动画的最佳解决方案?

huangapple
  • 本文由 发表于 2020年8月23日 19:58:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/63546656.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定