Yes Jrlowe, there are some bugs with boxes where the corners hit. I am not too worried about it though, since boxes can't intersect in real life. I might do something to stop the boxes from hitting like that though.
@leaderchicken, if you look above, ledzep has already implemented the move() method and he already is using the setrotation methods.
@ledzep, to answer your question about changing the direction of the bullet, just set move(-speed); instead of move(speed). Also, about the errors mentioned by leaderchicked, you can easily fix them following these steps:
first, remove the checkBoundaries(); method from your act() method so it looks like this:
public void act()
{
move(-speed);
setRotation(getRotation());
destroyEnemies();
}
second, change your destroyEnemies() code to this:
public void destroyEnemies()
{
//"Enemy" can be any class that you want the Strel to destroy.
Actor enemy = getOneIntersectingObject(Avion2.class);
if(enemy !=null)
{
getWorld().removeObject(enemy);
getWorld().removeObject(this);
}
else checkBoundaries();
}
what I have done here is added an else block so the computer asks itself "have i hit anything?" if not, then he checks to see if he is at the end of the world.
Also, on some of the walls, your bullet is not removing itself, so change your checkboundaries() code to this:
public void checkBoundaries()
{
if(getX() > getWorld().getWidth() - 2)
{
getWorld().removeObject(this);
}
else if(getX() < 1)
{
getWorld().removeObject(this);
}
else if(getY() > getWorld().getHeight() - 2)
{
getWorld().removeObject(this);
}
else if(getY() < 1)
{
getWorld().removeObject(this);
}
}
This might seem like a lot, but really I have barely changed your code.
2013/1/9
Textured Cube
2013/1/9
Textured Cube
2013/1/7
Isometric wave
2012/12/30
Physics2
2012/12/24
Water Works
2012/12/24
StarField
2012/12/24
Aero Shooting Planes (HELP)
2012/12/24
FireWorks
2012/12/24
Aero Shooting Planes (HELP)