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
HELP ASAP
By envxity, with 1 reply.
Replied to by danpost, over 2 years 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 2 years 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 2 years ago:
Thank you very much :)
Demon class killing villagers that are being grabbed
By KCee, with 22 replies.
Last reply by Spock47, over 2 years 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 2 years 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 2 years 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 2 years 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 2 years 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 2 years 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 2 years 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 2 years ago:
fr
how to change an actors color
By envxity, with 13 replies.
Last reply by danpost, over 2 years ago:
envxity wrote...
i keep on getting a null pointer exception for the turn towards mouse how do i fix it?
Try this then: <Code Omitted>
i dont want it to only turn towards the mouse when i click i want it to always follow my mouse if the button is gre
How would I make an actor grab another actor and drag them off the screen?
By KCee, with 9 replies.
Last reply by danpost, over 2 years ago:
KCee wrote...
I cant make it "private void checkHitPedestrian()" because the checkHitPedestrian method is in my vehicle superclass as a boolean which my monster class is under. << Codes Omitted >>
Then use this for the method:
I want all actors under my Vehicle superclass to speedup during an event
By KCee, with 4 replies.
Last reply by envxity, over 2 years ago:
o im sorry i didnt help :(
How do I make an actor turn into a frog upon contact with another actor
By KCee, with 1 reply.
Replied to by danpost, over 2 years ago:
KCee wrote...
i have two actors under the same superclass "Pedestrian". One of the actors is called villager and I want him to turn into a frog upon contact with the other actor called "EvilWitch". << Codes Omitted >>
Looks like you have code in the
Villager
class to do just that. Only problem is that if contact with
EvilWitch
is more than one
act
step, which is most probably the case, then the image will be made smaller multiple times; and, at some point, it will try to make it a size that is zero or less, causing an error. You need a way to check whether the a
23
24
25
26
27
28
29
X