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
creating a guided game about computer parts for kids
By uncfan44, with 14 replies.
Last reply by uncfan44, over 9 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 9 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 9 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 9 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 9 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 9 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 9 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 9 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
Death Condition
By aprianil, with 5 replies.
Last reply by danpost, over 9 years ago:
JonSkyWalker wrote...
So the code you gave should work? but we need to add an instance int field in the class of the enemy?
This is an internal counter here. In your case, I thought you had a healthbar that is shown. The healthbar might have the instance int field in its class.
HP Decrease and Death Condition
By JonSkyWalker, with 5 replies.
Last reply by danpost, over 9 years ago:
You already have the Veylectra object as an Actor object called 'badguy'. You should get the healthbar from it. Something like this: <Code Omitted>
Time Counter
By Babyhoof, with 1 reply.
Replied to by danpost, almost 10 years ago:
Babyhoof wrote...
I am trying to make an edited version of asteroids that instead counts the time you have been alive. Is there any way to do this?
Yes. You can have two counter fields -- one to track the act cycles and one to track "seconds" (or groups of act cycles -- usually around 55 per second). So every time the act counter reaches 55 add one to the timer and reset the act counter back to zero. You can use a simple actor object to display the time elapsed. This is discussed in my
Value Display Tutorial
scenario.
health
By Walker, with 2 replies.
Last reply by valdes, almost 10 years ago:
I recomend you add an integer field, not boolean. After the declaration of your class, put private int health = some_number; this number will be the initial health of your Actor. In the if (), decrease the value of health. Example health--; Then you will have to add another if in the act() method to check if the Actor is dead and end the game. if (health <= 0)
Hair-pulling error, please help?
By thesaltyhobbit, with 2 replies.
Last reply by thesaltyhobbit, almost 10 years ago:
Thanks!
why is my game skipping round two
By divinity, with 15 replies.
Last reply by danpost, almost 10 years ago:
divinity wrote...
as soon as i fixed everything else i will delete the junk codes and dem
At least remove lines 224 to 233. If execution makes it to that 'while' loop, it will run forever (an infinite loop) as the value of 'wrongcount' is not incremented within that loop.
How do i use getObjectsInRange with enemy facing a certain direction, depending on what side they are on the character
By FutureCoder, with 6 replies.
Last reply by FutureCoder, almost 10 years ago:
Thanks, it works now.
471
472
473
474
475
476
477
X