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
How do i permanently remove an object.
By alex90, with 5 replies.
Last reply by danpost, about 3 years ago:
alex90 wrote...
if i try to delete it then it says thatvariable isnt declared << Code Omitted >> this is the code
You have 9 different worlds. That is not bad, in and of itself; but, I am sure it would be taxing on memory if you all of them existing at the same time. So, my first suggestion may not be the best approach. Since I do not know anything about your worlds, no suggestion can be formulated at this time. Please provide world class codes for which cat is initially located. Now, if there was a way to "save" your worlds using minimal data (without saving the worlds themsel
I wanna make a cage fall from the sky
By KCee, with 1 reply.
Replied to by danpost, about 3 years ago:
KCee wrote...
I have a rope trap that upon contact with the animal, I want to trigger a cage above the animal to fall down, and trap the animal under it for a couple of seconds. how would i make the cage fall down? << Code Omitted >>
In line 27 of
Rope
class, you probably want the y-coordinate of the
addObject
line to be zero. Then, in the
act
method of the
Cage
class, you need the falling code:
I want my trap to only activate when an animal touches the centre of the image
By KCee, with 1 reply.
Replied to by danpost, about 3 years ago:
KCee wrote...
I have a bear trap class thats supposed to activate and play a closing animation , holding the animal in place for a few seconds and dealing a bit of damage . The problem is that the animation is playing as soon as the animal touches the edge of the trap, so it holds the animal in place and does damage, but the animal isnt in the bear trap, its to the right or left of it. How would i make it activate only when it touches the centre of the image. << Code Omitted >>
Use the
getOneObjectAtOffset
method:
Help with J Option pane
By Mitchell.School, with 4 replies.
Last reply by danpost, about 3 years ago:
Mitchell.School wrote...
still repeats itself even if i enter 1-3 which is weird because the squareValue input works and this one works if i have it be triggered by pressing a key << Code Omitted >> because that works but the other one doesn't
The code provided by myself was tested before posting. I am quite sure it, by itself, is not the problem. Please show your updated code.
I wanna make an electric effect that stuns animals that touch it for a few seconds
By KCee, with 3 replies.
Last reply by danpost, about 3 years ago:
KCee wrote...
how would i make the animal stay in place? would i put (speed = 0) under health--;?
I thought I took care of that with line 12. However, it seems to be misplaced. Move line 12 two lines down to have lines 6 through 15 look like this: <Code Omitted>As long as the provided code is placed in the act method before the movement code, It should now work as required.
I have a poison trap that I want to deal tick damage (damage overtime)
By KCee, with 6 replies.
Last reply by danpost, about 3 years ago:
KCee wrote...
wait does the poison only deal damage while the animal is in contact with it or does it deal damage even after its left contact? because i want the animal to be poisoned even after leaving contact with the poison cloud
If being poisoned is to be a state of an animal, then the damage should be controlled by the animal, not by the poison object. So, forget everything I stated above. In
Animal
class, add:
Published my first scenario, but now it is stuck on initializing
By Merten, with 5 replies.
Last reply by danpost, about 3 years ago:
Merten wrote...
<< Codes Omitted >>
You posted all these classes (excepting
Speler
and
Sline_Koning
) for what reason? I cannot be certain, but it might be the use of the
GifImage
class that is causing problems on the site.
I want to assign multiple keys for movement, A and Left Key What would be the code for that ?
By TheGoatFighter, with 2 replies.
Last reply by danpost, about 3 years ago:
TheGoatFighter wrote...
<Code Omitted>It is showing an error and that I can't use &&
Of course not. Only
boolean
values (
true
/
false
) can be
#AND#
ed (using '&&') Also, you do not want the actor to move only if both keys are pressed at the same time. You want "if either key is down", which means you need to
#OR#
('||') the
boolean
values: <Code Omitted>
How to switch images slowly?
By UAT123, with 3 replies.
Last reply by danpost, about 3 years ago:
UAT123 wrote...
Thanks for replying but the image doesn't switch when the food is eaten. I wonder if it has anything to do with this bit of the code: << Code Omitted >>
No. That code should be fine. Please present your current class codes in full.
Can sombody tell me why the game does not work in the second space world?
By stijn.b, with 5 replies.
Last reply by danpost, about 3 years ago:
One way to "fix" it is as follows (in
Shot
class): <Code Omitted>Although there is probably an easier way -- like having an intermediate class between
World
and the two space worlds (maybe
Can sombody tell me why the game does not work in the second space world?
By stijn.b, with 14 replies.
Last reply by danpost, about 3 years ago:
stijn.b wrote...
<< Codes Omitted >>
What about the
Space2
class code?
How to make a loot dropping system with chance attached to it
By Deepfist, with 2 replies.
Last reply by Deepfist, about 3 years ago:
Ok thx, didn't know that getRandomNumber also worked like that so that's my bad
How can i invert this code
By Hhe, with 2 replies.
Last reply by Hhe, about 3 years ago:
OMG youre right
Greenfoot uploading old version of my game
By BigCakeTwo, with 1 reply.
Replied to by danpost, about 3 years ago:
BigCakeTwo wrote...
I have tried to upload a scenario to this website however when I launch the scenario on its page it plays an older version, which loads into a test scene I used while developing the game. I have tried deleting the test scene from the scenario project files before uploading it and uploading it under a new name but the scenario still loads into the deleted test scene instead of the actual game. Is there some way to fix this problem or is my project just broken?
If deleting the files by way of file directory actions, you need to delete ALL 3 files related to the test sc
I wanna play an explosion animation using 14 images i have of the explosion
By KCee, with 7 replies.
Last reply by danpost, about 3 years ago:
KCee wrote...
How do i make the animations play out faster? I tried manipulating the numbers in setImage but its giving me errors like << Error Trace Omitted >> << Code Omitted >>
The number that needs changed appears several times in the
setImage
method. Also, it should probably be a constant for the
Explosion
class: <Code Omitted>Your
setImage
method can then be modified to this:
23
24
25
26
27
28
29
X