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

2017/1/19

Counter

1
2
3
jacquelinereilly jacquelinereilly

2017/1/19

#
It works! thank you so much
jacquelinereilly jacquelinereilly

2017/1/20

#
how would I do this for the next level?
 ((Level1) getWorld ()).counter.setScore ();
I added that and just changed Level1 to Level2,
Super_Hippo Super_Hippo

2017/1/20

#
Try this to prevent errors.
if (getWorld() instanceof Level1)  ((Level1) getWorld()).counter.setScore();
else if (getWorld() instanceof Level2)  ((Level2) getWorld()).counter.setScore();
else if (getWorld() instanceof Level3)  ((Level3) getWorld()).counter.setScore();
//....
jacquelinereilly jacquelinereilly

2017/1/20

#
so everything from this conversation would work if I did what you just sent? :)
Super_Hippo Super_Hippo

2017/1/20

#
I think so, yes.
jacquelinereilly jacquelinereilly

2017/1/20

#
okay, I just place it underneath what I sent?
Super_Hippo Super_Hippo

2017/1/20

#
You replace the first one, too.
jacquelinereilly jacquelinereilly

2017/1/20

#
yes it worked!!! thanks so much (:
You need to login to post a reply.
1
2
3