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
terminal window because isatedge
By gijsdevries, with 2 replies.
Last reply by TheGoatFighter, over 1 year ago:
This code is so easy, danpost 1v1 me on greenfoot on the 21st September 2029
need help with transferring the score counter to a new level
By Merten, with 3 replies.
Last reply by danpost, over 1 year ago:
Merten wrote...
i have done that but now at the end of level 2 the game crashes when i hit an enemy. error: java.lang.NullPointerException. this is at class Kogel, line 80
Along with the
addObject
line you inserted above, also add the following line: <Code Omitted>(and similiarly with other level changes)
I get a terminal window for whatever reason
By gijsdevries, with 1 reply.
Replied to by danpost, over 1 year ago:
gijsdevries wrote...
i get a terminal window because of the line of code at rule 16. does anyone know how to fix this? when i remove rule 18 it works fine but i need that rule in my code << Code Omitted >>
The problem is that when you remove this actor from the world in the
vermoordMonster
method, then go back to the
act
method, it then calls the
vermoordNachtbaas
method, which require the actor still be in the world. Easy fix is to either change line 11 (in
act
) to: <Code Omitted> OR, insert the following line
How do can i make a class follow another class around the world?
By Rainescap, with 7 replies.
Last reply by danpost, over 1 year ago:
Rainescap wrote...
how would i start the code for the collision?
What type of actors is the
Shield
instance protecting the spaceship from?
HELP ASAP
By envxity, with 1 reply.
Replied to by danpost, over 1 year ago:
envxity wrote...
so i ruined my game that i was making and now it barely works like it was meant to here is the source code its due today. so pls help << Codes Omitted >>
I did notice that in multiple places you have images being created continuously (every act frame). Image creation/manipulation can be a hog on CPU time and may cause some lagging. Also, I noticed that you have the health bar and the counter doing things they should not. GUI objects, as such, should be prompted to do things, not do them on their own -- and only do those things when required. In other words, they
how to spawn zombies with different stats after a set amount of time
By envxity, with 1 reply.
Replied to by Spock47, over 1 year ago:
The current code modifies an already existing zombie. I guess you want to spawn a *new* zombie, right? A new zombie can be created by calling the constructor, presumably "new Zombie();". This zombie then has to be placed into the world (addObject method). Assuming the code you showed is in method spawnZombie of your world class, you can try this:
In need of help
By JustAphochen, with 4 replies.
Last reply by JustAphochen, over 1 year ago:
Thank you very much :)
Demon class killing villagers that are being grabbed
By KCee, with 22 replies.
Last reply by Spock47, over 1 year ago:
You're welcome. I am glad to help. I hope you found some fun with programming and keep coding.
i want actors in my simulation to pass actors in front of them
By KCee, with 8 replies.
Last reply by danpost, over 1 year ago:
Looks like the distance between lanes is 54 (/** lane offset value */).
I want my actor to let go of another actor after a certain time frame
By KCee, with 15 replies.
Last reply by danpost, over 1 year ago:
Spock47 wrote...
That would be a possibility, too. But in that case, the poison cloud would only go after villagers, but not other pedestrians.
You are right. Might be better to have an (empty)
abstract grabPedestrian
method in the
Grabber
class and have each sub-type deal with their own specific behavior. If it is their specific behavior, then it makes sense to have the code in their specific classes.
how to find nearest object.
By envxity, with 1 reply.
Replied to by danpost, over 1 year ago:
envxity wrote...
so dan with the auto fire it works but not as intendid so it does fire out but it fires out like 2-3 strands of bullets at the same time and i dont want that and it also didnt turn the player to face where it was shooting. so i figured that i would have to use the getobjects in range function but i cant figure out how to do it here is the code: << Code Omitted >>
Try this:
My Demon class has a NullPointerException when spawning into the world
By KCee, with 3 replies.
Last reply by Spock47, over 1 year ago:
KCee wrote...
Thanks that worked! Theres a small problem now the blood demon isnt removing the villager from the world on contact, instead its just going up to it, then spinning in circles?
Seems to me that "getOneObjectAtOffset((int)speed + getImage().getWidth()/2, 0, Pedestrian.class);" is only working correctly if the demon meets the pedestrian's center exactly? Try with "getOneIntersectingObject(Pedestrian.class);":
NullPointerException in Grabber Class
By KCee, with 1 reply.
Replied to by Spock47, over 1 year ago:
KCee wrote...
<Code Omitted>
grabbed can be null there, so replace the quoted lines with this (it moves the relevant line into the part where grabbed is checked to not be null):
how to reload
By envxity, with 4 replies.
Last reply by danpost, over 1 year ago:
envxity wrote...
and i have another question how would i have a display that would show how much ammo you have left out of the starting amount of ammo
Please refer to my
Value Display Tutorial
scenario.
Error with Zombies
By RandomGuy, with 4 replies.
Last reply by envxity, over 1 year ago:
fr
18
19
20
21
22
23
24
X