This site requires JavaScript, please enable it in your browser!
Greenfoot back
Game/maniac
Game/maniac wrote ...

2012/10/18

Can any body fix this?

Game/maniac Game/maniac

2012/10/18

#
Sometimes when you hit a wall instead of bouncing off it you get stuck, here is the link to the source code , plz post how to fix this
danpost danpost

2012/10/19

#
The tank stays in the middle of the screen. How can it hit a wall? Maybe ... well, I AM a bit confused. Explain exactly what is doing what? Use all that apply: who, what, where, when, why, how, which.
Game/maniac Game/maniac

2012/10/19

#
Sorry I posted the wrong link here is the real Link
danpost danpost

2012/10/19

#
Changing the 'atWorldEdge' method to the following helped a bit
public boolean atWorldEdge()
{
    int wide = getImage().getWidth();
    if(getX() < wide / 2 || getX() > getWorld().getWidth() - wide / 2) return true;
    int high = getImage().getHeight();
    if(getY() < high / 2 || getY() > getWorld().getHeight() - high / 2) return true;
    return false;
}
What might also help is if you moved back before turning when at a world edge (getting off the edge to hopefully avoid repetitive turning at a world edge. Insert a 'move(-3);' before the turn statement for the actor when at the world edge.
Game/maniac Game/maniac

2012/10/19

#
Thanks
You need to login to post a reply.