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

Comments for tut-access-p2

Return to tut-access-p2

A new version of this scenario was uploaded on Tue Jan 18 09:03:13 UTC 2011 Changed the design a bit.
btj9btj9

2011/11/1

Thank you so very much for giving a tutorial on a simple counter!!!!!
ProdigyProdigy

2012/5/20

Thanks a ton for this.
franmanfranman

2012/10/10

Alright so I've tried to do the exercise myself. I've followed the instructions as told and compare to the answer. It seems the code matches and while I compiled it the counter does not change every time I shot an asteroid. Please help.
amal_Azabamal_Azab

2012/11/15

thanks I tried my self and I found it very useful
Cool! I was having a hard time trying to figure it out. Thanks!
Au79Au79

2014/3/22

Thank you very much!, this is very helpful!
jordan93jordan93

2015/3/24

THANKS ! it was cool!
JMB123JMB123

2015/4/8

OMG thank you... I might become famous for this all thanks to you..YOU...Dave just. just thanks!
Not working for me :( Compiling works, no errors getting returned. But if a shot hits an asteroid it says: ------------------------------------------------------------------------------------- java.lang.NullPointerException at Shot.hitAnAsteroid(Shot.java:58) at Shot.act(Shot.java:34) at greenfoot.core.Simulation.actActor(Simulation.java:594) at greenfoot.core.Simulation.runOneLoop(Simulation.java:552) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205) -------------------------------------------------------------------------------------------------- private void hitAnAsteroid() { Space spaceWorld = (Space) getWorld(); // get a reference to the world XX Counter counter = spaceWorld.getCounter(); // get a reference to the counter XX counter.bumpCount(5); } -------------------------------------------------------------------------------------------------- that´s the code, the line marked with X´s is supposedly containing the error... but i dont get it Any help appreciated :)
Super_HippoSuper_Hippo

2017/6/14

I guess you changed the code of the class. You added at least four lines of code. The original one works without errors. What did you change (for example in the act method)? It would probably be the best to open a new discussion with a link to this scenario instead.
VenbhaVenbha

2017/8/27

WOW!!!!!!!!
VenbhaVenbha

2017/8/27

Nice
Roshan123Roshan123

2020/6/23

i have a doubt i your tutorial will it work or not //in rocket.class //globally Counter counter; //i already added it in the world i.e. Counter counter=new Counter addObject(counter,150,100) //in hitByAsteriod() method { counter.bumpCount(5); }
Roshan123Roshan123

2020/6/23

plz ignore upper comment
Roshan123Roshan123

2020/6/23

reply this one i have a doubt in your tutorial will it work or not //in rocket.class //globally Counter counter; //i already added it in the world i.e. Counter counter=new Counter addObject(counter,150,100) //in hitByAsteriod() method of Rocket.class { counter.bumpCount(5); }