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

2018/4/18

Level Select

1
2
danpost danpost

2018/4/19

#
student1 wrote...
so this << Code Omitted >>
I missed something first time around here. You cannot use removeObject on a class -- it requires an Actor object. Chance "Coin.class" in line 6 to "coin". You seem to have dropped the first line in your act code (Actor coin;).
student1 student1

2018/4/19

#
the last comment didn't you say that i didn't need it and the removeObject part it should be this
getWorld().removeObject(coin);
danpost danpost

2018/4/19

#
student1 wrote...
the last comment didn't you say that i didn't need it and the removeObject part it should be this
getWorld().removeObject(coin);
No.
Yehuda Yehuda

2018/4/20

#
"coinNum + 1" is not storing any value in a variable. If you want to add 1 to an int variable you should do:
coinNum++;

// same as
coinNum = coinNum + 1;
danpost's "no" is meant to be going on the first part of your last post not the second part. Also, to change to a new world you should do "Greenfoot.setWorld" not "getWorld" (like you were wrongly told).
danpost danpost

2018/4/20

#
Yehuda wrote...
to change to a new world you should do "Greenfoot.setWorld" not "getWorld" (like you were wrongly told).
That must of been a senior moment when I posted this:
danpost wrote...
Change "Greenfoot" to "getWorld" on lines 7 and 12 (getWorld is a World object method -- not a Greenfoot class method).
I should not have included line 12 and neither line uses the getWorld method and that method is an Actor object method , not a World object method. It should have said:
Change "Greenfoot" to "getWorld" on lines 7 (removeObject is a World object method -- not a Greenfoot class method).
You need to login to post a reply.
1
2