This site requires JavaScript, please enable it in your browser!
Greenfoot back
anky689@gmail.com
anky689@gmail.com wrote ...

2013/9/9

Gumball machine problem

anky689@gmail.com anky689@gmail.com

2013/9/9

#
I am new to greenfoot. I need help in a scenario. There is a gumball machine, there are three types of coins, one is adollar, one is fake coin and one is a dime. I am able to to insert coins into machine and disappear coins too. now i want a message to be displayed like "Coin is here".After that an alien should come and inspect the coin if its real or not. And display message that coin is real if its so. else print "fake coin". Please help me in writing code.
danpost danpost

2013/9/9

#
What you need is a Text class; a class that creates objects that display some texts. A very simple Text class is given here. The code is sufficient to create a text object with some text and also change the text of an already created Text object. As far as the animation with the alien, you need to try to create some code; then, if you have problems with it, post the code you tried, explain what you want and what you do not want (specifically), and ask for help.
anky689@gmail.com anky689@gmail.com

2013/9/9

#
thanks danpost. i need further help like on click of mouse i want the object to come near machine and as that object comes near machine a message should be displayed? Secondly, how do i call different class or actors in a real time. As i cannot create an object in a default world.
danpost danpost

2013/9/9

#
Again, I would ask that you try to create some (hopefully) workable code to do what you want and if you encounter problems, post the code with an explanation. If you are not creating any code, you are probably not learning anything. If you are at a total loss, then you probably should review the methods that are available in the greenfoot package. If you are not familiar at all with the Java language, then you should probably consult the java tutorials -- especially the section on Learning the Java Language.
You need to login to post a reply.