This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Discussions
You need to login to take part
Current Discussions
Basic point system?
By Armac290, with 1 reply.
Replied to by danpost, over 10 years ago:
Armac290 wrote...
I was wondering if anyone could show me a way to make a basic point scoring system with a display.
That is discussed in my
Value Display Tutorial
scenario. Take a look.
MouseObject help
By Walker, with 1 reply.
Replied to by danpost, over 10 years ago:
The action you require, which you represent (as code that will not compile) from line 16 through 19 is better off placed in the Gaster class act method. The reason is does not compile is that the Greenfoot class method 'mouseClicked' requires an object of type World or Actor (or 'null' if none is to be specified -- or, if the click can be anywhere). You cannot click on a class; you click on objects. In the Gaster class, you can use 'this' as the object: <Code Omitted>
Counter Help
By carter, with 1 reply.
Replied to by danpost, over 10 years ago:
carter wrote...
I am making a card game and I need a counter to count how many cards have been flipped. I have 4 cards on the screen and will have more on other levels. I have no idea how to make a counter or how to use one so please explain carefully as I am a new coder.
My
Value Display Tutorial
scenario can give you pointers on this subject.
Relationships between actors
By Itta, with 1 reply.
Replied to by danpost, over 10 years ago:
You could have Ykey move left, check for Hiro and move back, then perform any action needed if Hiro was there: <Code Omitted>
The GreenfootSound API method of sound.stop(); is not working for me
By LaughingArcher42, with 2 replies.
Last reply by LaughingArcher42, over 10 years ago:
Thank you for the help! Making the sound static was all I needed to do :)
Problem with IsKeyDown() and backgrounds
By M8R1X, with 1 reply.
Replied to by danpost, over 10 years ago:
The 'while' loop, lines 46 through 55 appears to be an infinite loop. The condition, 'true', will obviously never be 'false' and there are no 'break' statements within the block to break out of the loop.
Problem in implementing Starting Menu
By Nagogi, with 1 reply.
Replied to by danpost, over 10 years ago:
The main problem is where you placed the lines 9 through 13 in the Level101 class. The block of code, lines 3 through 16 is called the constructor of the Level101 class. It is executed one time per object created from the class -- or, once, when your Level101 world is created. The menu will certainly not be in the state of "is done" at the time it is being adding it into the world -- and since the code (lines 3 through 16) will NEVER execute again for that particular Level101 world object, lines 11 and 12 will never be executed. The lines 9 through 13 need to be somewhere where the code wi
creating a guided game about computer parts for kids
By uncfan44, with 14 replies.
Last reply by uncfan44, over 10 years ago:
didnt know the empty act method would over ride something in compparts, fixed it and everything works fine, just need to move and resize to clean up the looks! you are the man sir!
Remove multiple objects after one has been clicked
By jakeIon, with 1 reply.
Replied to by danpost, over 10 years ago:
What class do the Scenario1, Scenario2 an Scenario3 classes extend?
jakeIon wrote...
The objects are titled: Scenario1, Scenario2, and Scenario3.
Actually, to clarify, the objects are not titled with those names -- the classes that these objects were created from are called by those names. You need to supply any object created from any class a name of your choosing for them to have names. Also, you must do so at the proper place to be usable at all the possible places you need them to be. Examples of giving objects names follows:
Add an object, and remove an object after a while
By carter, with 4 replies.
Last reply by danpost, over 10 years ago:
carter wrote...
I read that when you do the delay, it stops the whole program, and if that is true, I have other actions going on at this time
It does. If that is not an option, the you need a reference field for the Correct object and an int field to count out some act cycles before removing it:
Need help!!
By MLP, with 3 replies.
Last reply by danpost, over 10 years ago:
Xxmostwanted18xX wrote...
HI I AM STUCK ON CHAPTER 6 CAN YOU HELP ME
What is the issue you are having? and chapter 6 of which book/version? what code have you tried? Should start a new discussion thread so we do not have two issues competing against each other on the same discussion thread.
Need help with scrolling world
By jmsmall, with 1 reply.
Replied to by danpost, over 10 years ago:
Please do not create more than one discussion thread on the same issue.
Please do not reply to this thread.
Discussion was continued on a different thread.
Changing a Boolean value
By carter, with 7 replies.
Last reply by danpost, over 10 years ago:
carter wrote...
Every card has its own image for the back
Then you cannot do it the way I suggested above. You will need a boolean field; but again, it should be an instance field (not a static field for each card). In fact, maybe it would be easier to put the two images for each card in an array and use an int field to point (as an index for the array) to the current image:
How to make an object appear after run is clicked
By coder04, with 1 reply.
Replied to by danpost, over 10 years ago:
coder04 wrote...
So I have added an image but I only want it to appear once run is clicked so is there any way for that?
Add the following method to that world class: <Code Omitted>The started method is called for that world by greenfoot when it is the active world and the scenario goes from a paused state to a running state. I added the 'if' condition to prevent it from adding another if the scenario is paused and restarted. Of course, the name of the class of the object you wa
Trouble Adding an Object
By carter, with 5 replies.
Last reply by danpost, over 10 years ago:
carter wrote...
Can I use this code in the class Cards, or does it have to be in Card1, Card2 etc.?
If you have similar members (methods and/or fields) in all the subclasses, then you only need to code it once, in the superclass -- as 'public' or 'protected'. So, yes. For example, your static Boolean fields for card#flipped -- you only need to declare one non-static boolean in the Cards class for that. 'Flipped' is a state of a card and is not something that pertains to all cards as a whole. So, it is the state of an instance of the Cards class. Now, something like the image on t
472
473
474
475
476
477
478
X