Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sorry, I can't follow your thoughts completely. But, I understand you are handling a lot of squares and lines in different styles. And that's where you are right, you don't need any <code>Sprites</code> for that, <code>AndEngine</code> has some classes to draw simple things and it is way faster than Sprites.</p> <p><strong>basic example that reproduces your graphic with lines</strong></p> <pre><code>// first the green lines (they are under the black ones) Line[] greenLines = new Line[8]; // from (x0 ,y0) to (x1,y1) with lineWidth=5px // the outer square greenLines[0] = new Line(0, 0, 100, 0, 5, vertexBufferObjectManager); // top line greenLines[1] = new Line(100, 0, 100, 100, 5, vertexBufferObjectManager); // right line greenLines[2] = new Line(100, 100, 0, 100, 5, vertexBufferObjectManager); // bottom line greenLines[3] = new Line(0, 100, 0, 0, 5, vertexBufferObjectManager); // left line // inner horizontal lines greenLines[4] = new Line(0, 33, 100, 33, 5, vertexBufferObjectManager); greenLines[5] = new Line(0, 66, 100, 66, 5, vertexBufferObjectManager); // inner vertical lines greenLines[6] = new Line(33, 0, 33, 100, 5, vertexBufferObjectManager); greenLines[7] = new Line(66, 0, 66, 100, 5, vertexBufferObjectManager); // now the black lines Line[] blackLines = new Line[4]; blackLines[0] = new Line(0, 15, 100, 15, 5, vertexBufferObjectManager); blackLines[1] = new Line(0, 81, 100, 81, 5, vertexBufferObjectManager); blackLines[2] = new Line(15, 0, 15, 100, 5, vertexBufferObjectManager); blackLines[3] = new Line(81, 0, 81, 100, 5, vertexBufferObjectManager); // now set the color and attach the lines to the scene (green) for(Line line: greenLines){ line.setColor(0f,1f,0f); myScene.attachChild(line); } // now set the color and attach the lines to the scene (black) for(Line line: blackLines){ line.setColor(0f,0f,0f); myScene.attachChild(line); } </code></pre> <p>this above example should actually work. Now you only have to change it and adjust it to your needs. If you want to change a line you could call <code>myLine.setPosition(fromX, fromY, toX, toY);</code> oh and a rectangle is quite simple as well: <code>Rectangle rectangle = new Rectangle(50,50,100,100, 5, vertexBufferObjectManager);</code> for a rectangle that starts at (50,50) and is 100 pixels wide and 100 pixels high. And has a line width of 5 pixels. You can set the color of the Rectangle as you can for the lines. The only <em>problem</em> is, that the rectangle is always filled. If you want an empty rectangle you have to draw it with lines.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload