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

2014/6/13

counter?

spatel493 spatel493

2014/6/13

#
How do I make a counter that will count the number of fish my cat eats in my game?
danpost danpost

2014/6/13

#
Do you want to have the number of fish eaten displayed throughout the game or just have an internal counter whose value is displayed at the end of the game?
jmwalker jmwalker

2014/6/17

#
Dan URGENT Please help, new to Greenfoot and need simple (very simple) instructions which will count leaves that the wombat eats and count crabs that the lobster eats (starter tutorials in Greenfoot). Please could you give me instructions as to how to display number eaten throughout the game and if I have just an internal counter which displays value at the end of the game. Please could you provide source code.
danpost danpost

2014/6/18

#
You will need an internal counter either way (whether displaying throughout the game or just at the end). You just need an instance int field added to the Wombat class for keeping track of how many leaves it eats and an instance int field added to the Lobster class to keep track of how many crabs it eats. Refer to the page onDeclaring Member Variables of the Java tutorials to see how to add these instance fields.
You need to login to post a reply.