Dylan Butler
- Forum posts: 1
Sep 18, 2012, 7:36:25 PM via Website
Sep 18, 2012 7:36:25 PM via Website
So I am very new to android development, it's actually the only programming language I have ever tried to learn, after reading and following alot of online tutorials I still seem not too know that much. Right now I have a few errors in my code that I can't seem to figure out. I will post a screenshot of my eclipse and maybe someone can give me some advice as too what I need to do to fix my errors.
public void render() {
// render blocks
debugRenderer.setProjectionMatrix(cam.combined);
debugRenderer.begin(ShapeType.Rectangle);
for (Block block : world.getBlocks()) {
Rectangle rect = block.getBounds(); errors here are exactly the same as below but for type block.
float x1 = block.getPosition().x1 + rect.x;
float y1 = block.getPosition().y1 + rect.y;
debugRenderer.setColor(new Color(1, 0, 0, 1));
debugRenderer.rect(x1, y1, rect.width, rect.height);
}
// render Bob
Bob bob = world.getBob();
Rectangle rect = bob.getBounds(); error here says that getBounds is undefined in type bob
float x1 = bob.getPosition().x + rect.x; errors here and the line below state that getPosition is undefined in type bob.
float y1 = bob.getPosition().y + rect.y;
debugRenderer.setColor(new Color(0, 1, 0, 1));
debugRenderer.rect(x1, y1, rect.width, rect.height);
debugRenderer.end();
}
}
Then if I add the methods to block,java and bob.java it then still returns with an error saying that the .x and .y are not right so i delete them then the other x's and y's arnt right. I am so confused.
public void render() {
// render blocks
debugRenderer.setProjectionMatrix(cam.combined);
debugRenderer.begin(ShapeType.Rectangle);
for (Block block : world.getBlocks()) {
Rectangle rect = block.getBounds(); errors here are exactly the same as below but for type block.
float x1 = block.getPosition().x1 + rect.x;
float y1 = block.getPosition().y1 + rect.y;
debugRenderer.setColor(new Color(1, 0, 0, 1));
debugRenderer.rect(x1, y1, rect.width, rect.height);
}
// render Bob
Bob bob = world.getBob();
Rectangle rect = bob.getBounds(); error here says that getBounds is undefined in type bob
float x1 = bob.getPosition().x + rect.x; errors here and the line below state that getPosition is undefined in type bob.
float y1 = bob.getPosition().y + rect.y;
debugRenderer.setColor(new Color(0, 1, 0, 1));
debugRenderer.rect(x1, y1, rect.width, rect.height);
debugRenderer.end();
}
}
Then if I add the methods to block,java and bob.java it then still returns with an error saying that the .x and .y are not right so i delete them then the other x's and y's arnt right. I am so confused.
— modified on Sep 18, 2012, 8:00:17 PM
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.