【问题标题】:Get color of arc in libgdx在 libgdx 中获取弧的颜色
【发布时间】:2016-04-19 08:58:24
【问题描述】:

我画了许多五颜六色的弧线,它们围绕着一个球旋转。当用户触摸屏幕时,球会朝其指针的方向射击。 现在我想获得碰撞发生时与之碰撞的弧的颜色。 请帮忙.. 示例图像是这样的:

我想以 RGB 格式或哈希格式或任何我可以用来比较的已知格式获得输出。

请任何建议都会有所帮助...在此先感谢..

【问题讨论】:

  • 需要更多信息...你是如何绘制弧线的?您如何检测碰撞?

标签: libgdx


【解决方案1】:

您是否有理由不能简单地将每条弧线视为一个单独的实例,并将颜色存储在一个字段中?

 public class Arc
 {
    //color stored in the arc for easy retrieval
    public Color myColor = new Color(...);

    public void update()
    {
        //make the arc do everything the original arc was supposed to do
        //such as rotate, get drawn to the screen, etc
    }

    //One of many ways to retrieve the color during a collision
    public Color testCollision(Ball b)
    {
       if (/* Ball is colliding with arc */) return myColor;
       else return null;
    }
 }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多