Game Running slow in Android Handsets, no use of t

2019-09-18 10:54发布

I am making a game in which i am making arcs using ShapeRenderer, As i needed to rotate those arcs around the center so i wrote that code only begin and end in render method, I am initializing them in create method, But as the number of arcs increases the game gets slower and slower. I have maximum of 13 arcs and minimum 2 arcs. It running fine till few say 8 arcs and after that it gets slower. Please any one out there if he/she can help, please help... thanks in advance.

Render Method is having 5 loops, I don't have any choice to get rid of them.

this is in create:

for (int i = 0; i < 13; i++) { random = randomGenerator.nextInt(5); a[i] = new Arc(arcColors[random]); arcs_visible[i] = 1; pointercolor[i] = a[i].getArcColor(); a[i].begin(ShapeRenderer.ShapeType.Line); }

this is in render:

private void draw_one_arc(int i, double radius, float startangle, float sweep) {
        if (arcs_visible[i] == 1 && collides[i] == false) {

            a[i].arc(pointerorigin.x + pointer.getWidth() / 2, pointerorigin.y + pointer.getWidth() / 2, (float) radius, startangle, sweep, 100);
        }

    }

`

0条回答
登录 后发表回答