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

2012/6/25

Making actor score points/menu tourbleshooting.

2
3
4
5
SPower SPower

2012/6/26

#
What you might do is add this at the beginning of the method:
System.out.println("" + getRotation());
That will print the rotation into the debugger.
ThinkingPainter ThinkingPainter

2012/6/26

#
no errors
SPower SPower

2012/6/26

#
When I took a look at the Shot class, I saw that it couldn't do what you want: you have to change the code.
SPower SPower

2012/6/26

#
ThinkingPainter wrote...
no errors
Duhh
ThinkingPainter ThinkingPainter

2012/6/26

#
there it is
java.lang.StackOverflowError
	at greenfoot.Actor.getClassImage(Actor.java:628)
	at greenfoot.Actor.<init>(Actor.java:124)
	at Blip.<init>(Blip.java:50)
	at Blip.<init>(Blip.java:69)
SPower SPower

2012/6/26

#
In a method, you called the method itself, like this:
private void method()
{
    method();
}
SPower SPower

2012/6/26

#
Does it appear multiple times?
ThinkingPainter ThinkingPainter

2012/6/26

#
I'm going to play around with it thanks for the help.
SPower SPower

2012/6/26

#
Just change these lines in Shot:
int ypos = getY();  
 if (ypos > 0) {  
 ypos = ypos - 5;  
 setLocation(getX(), ypos);
to this:
int ypos = getY();
if (ypos > 0) {
    move(5);
ThinkingPainter ThinkingPainter

2012/6/26

#
just make it shoot to the right instead of straight up
ThinkingPainter ThinkingPainter

2012/6/26

#
* it just makes it shoot to the right instead of straight up i meant
SPower SPower

2012/6/26

#
Because of the rotation :)
danpost danpost

2012/6/27

#
Remove lines 67 through 72 (the code in question, currently in your eat() method). In your Shot class, replace lines 11 through 23 with:
public Shot(Blip blip)
{
    setRotation(blip.getRotation());
}
You will have to modify the code in you Shot class act() method, which at the moment only allows the shot to go straight up. HINT: use the move(int) method and make sure to check for all world edges (as well as objects).
ThinkingPainter ThinkingPainter

2012/6/27

#
Thank you dan it worked, glad too have some actual working code
You need to login to post a reply.
2
3
4
5