本文介绍了AndEngine:两个精灵的碰撞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个小的Andr​​oid游戏。之前,我开始使用AndEngine,我使用Canvas对象并在其上绘制的一切。为了进行测试,如果两个位图碰撞彼此,如果他们的边框重叠我检查。在这种情况下,我检查如果这两个位图重叠矩形共同得​​到了一个没有透明像素。
这种方法perfektly工作,我能够检测像素的完美碰撞。

I am developing a small Android game. Before I started using AndEngine, I used the Canvas object and draw everything on it. For testing if two bitmaps collides with each other I checked if their bounding boxes overlap. In case of this, I checked if the overlapping rectangle of both bitmaps got one none transparent pixel in common.This method worked perfektly and I was able to detect pixel perfect collisions.

因为我开始使用AndEngine一些性能问题。碰撞检测安静的工作很好,但是碰撞测试有两个精灵definitly dosent工作完美像素。在碰撞测试只是一个边界框测​​试。

Because of some performance issues I started using AndEngine. Collision detection works quiet good but collision tests for two sprites definitly dosent work pixel perfect. The collision tests is "just" a bounding box test.

推荐答案

下面是像素完善的检测一个很好的例子,

Here is a nice example of pixel perfect Detection,

这篇关于AndEngine:两个精灵的碰撞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 02:50