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
Problems using Counter in Text Actor
By KGCSTeacher, with 4 replies.
Last reply by danpost, over 7 years ago:
The same can be said for the
Good component
field. That is, the line: <Code Omitted>would need to read <Code Omitted>for the field to obtain a value and for the
getGood
method to return that object (and not
null
).
Right click on Actor not working
By ggongwer, with 4 replies.
Last reply by davmac, over 7 years ago:
I filed a
ticket
for this in our bug database, thanks.
Space Fighter
By ChristieK, with 1 reply.
Replied to by danpost, over 7 years ago:
You start with a World object and some Actor objects. What have you tried? (your question does not conform to site standards -- not specific enough and no code given).
Problem to access variable from world
By R4ylot, with 11 replies.
Last reply by R4ylot, over 7 years ago:
I tried now different solutions and I think I solved my problem now. Thank you for helping.
Send numbers of one array between two classes
By DanielG99, with 1 reply.
Replied to by danpost, over 7 years ago:
You can use a "getter" and a "setter" method in the class where the array is located. Like the following (presuming the array holds int values): <Code Omitted>Then in Class_B. you could use something like: <Code Omitted>
How to view documentation
By dr979312, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
Good question. The required HTML-Files come with the download. However, the program doesn't seem to find it. In the title it says "null" and you get an error when trying to open it in a browser telling you that the requested file can't be found. Unfortunately, I didn't find a way to make them appear by clicking on Actor/World. Seems to be a bug in 3.5.0. You can also find the Greenfoot API here:
https://www.greenfoot.org/files/javadoc/
Enemy Shot Question
By Mr.Cleaner, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
<Code Omitted>
How to make a enemy disappear
By Gautham, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
It depends on the condition. Examples: <Code Omitted><Code Omitted><Code Omitted><Code Omitted>
Different actions when holding down a button
By Recorsi, with 1 reply.
Replied to by Asenoju, over 7 years ago:
You could define a new variable which counts how long you press a button by adding +1 every act-step the button is pressed. Like so: <Code Omitted>
Trying to spawn 2 enemies when one is is killed
By adao3, with 1 reply.
Replied to by danpost, over 7 years ago:
One major problem is that
max
is a new variable every act cycle and is always initially set to
5
. Another issue with the current code is that as long as the number of
Enemy
object in the world is less than
max
,
max
will increase and always stay greater than the number of
Enemy
objects in the world. You can either add two Enemy object into the world at the same time or introduce a target field. However, maybe the best way is to override the removeObject method:
Having trouble with using a counter
By Alrightalright, with 1 reply.
Replied to by danpost, over 7 years ago:
All possible values for the counter are exhaustd by line 8 -- that is, the 3rd if block will never by executed. You can just remove the "else" from line 13, however, that code, as is, is a bit much. Try the following: <Code Omitted>Or, even shorter: <Code Omitted>
Null Pointer exception
By adao3, with 4 replies.
Last reply by adao3, over 7 years ago:
thank you that helped a ton
isKeyDown not working if key is held?
By ggongwer, with 1 reply.
Replied to by ggongwer, over 7 years ago:
Oops, never mind. I found it after all. If you are encountering this, the solution is at: https://www.greenfoot.org/doc/faq#macos-keys
Wall
By Dr.Dre, with 5 replies.
Last reply by Agent40, over 7 years ago:
In order for an object to not pass through an object of any kind you, it needs to receive the equal to opposite amount of force. This would be placed in the same area that the movement code is for each direction possible (or you can use a boolean to switch the values to add a bounce affect if it's an AI/Enemy).
Door opening
By Dr.Dre, with 2 replies.
Last reply by danpost, over 7 years ago:
Remove the word "boolean" from line 7. You are inadvertently creating a new variable there (which is NOT that declared on line 1). By removing the type on line 7, it will then refer to the one declared on line 1. Replace line 13 with the following: <Code Omitted>No
NullPointerException
error can then be caught here.
241
242
243
244
245
246
247
X