In the world class, add one new instance of this class at world creation using an empty string (" ").
here do you mean to make a new subclass from ChocolateDispenser world, or from Actor?
this is the source code for Class Counter, which is not completed yet, it needs some mathematical calculation for defining the value for n, before and after user buy the chocolate:
<Code omitted>
As far as I can tell, the only thing missing in the Counter class is a way to share its current value of credit. Add this method to the class:
public int getCredit()
{
return credit;
}
You will need this for when the product is purchased, to see what change needs returned.
I think the link for picture didn't come through, so I just type the link here.
https://www.dropbox.com/s/vhos6laqrgd0mt1/Screen%20Shot%202012-09-05%20at%2016.06.58.png
In the world class, add one new instance of this class at world creation using an empty string (" ").
here do you mean to make a new subclass from ChocolateDispenser world, or from Actor?
I think one of us is a little confused. My understanding is that you have a Counter, which displays the credit amount, a text for the clicked coin, which ?does? or ?does not? go on the image of the coin and a ScreenMessage, which displays messages. The method 'credit' that you added to the FivePence class is trying to draw your text string on the image of the coin, not on the world background (or any other object). You need to remove that method from that class and remove all statements regarding the image in that class. Next, if the text for the clicked coin is displayed with the ScreenMessage object, you need to send that object the new text to display using the technique I have shown above. If it is to be displayed on the coin image, you need a 'setImage' statement after the 'drawString' statement; but the offsets will need changed.
Hi Danpost
Thanks ever so much for your help yesterday, sorry I fell to sleep. lol
Today I tried to make a clas as you said, like " " but geenfoot does not accept the name
could you please help me with that?
Hi ManiHallam, I realized you were trying to put a text image to the Screen using a ScreenMessage. Explain exactly what you are trying to do and what you having a problem with. The more detailed you are, the better it will be, not only on the response, but on how quickly we resolve any issues. Thanks.