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
Use a variable in all classes
By gijsdevries, with 1 reply.
Replied to by danpost, over 2 years ago:
gijsdevries wrote...
Im making a game where you can score points when a bullet hits a monster. I also want to make a scoreboard but I cant use the variable I made for points in the scoreboard class. I already tried to make the variable public but that doesnt work. A video or an example code would be sufficient. Im kinda new to this so keep the code as simple as possible please :)
Please refer to my
Value Display Tutorial
scenario.
I need the bullet to follow my mouse
By gijsdevries, with 3 replies.
Last reply by danpost, over 2 years ago:
gijsdevries wrote...
Could you maybe give an example? right now I have this. The bullet only spawns at the coordinates of the mouse (a kogel means a bullet). << Code Omitted >>
I think all you need do is: <Code Omitted>Note that if your bullet moves too slow (less than maybe 5 pixels per move), the aiming will not be accurate -- maybe so inaccurate that it looks totally off. For the extreme example, if moving only 1 pixel per move, the movement will either be horizontal or vertical;
I want my villager subclass to change into a different image when touched
By KCee, with 1 reply.
Replied to by danpost, over 2 years ago:
Doesn't the
rooted
method get called when a
Villager
instance is touched by a
RootedCorpse
object? Change its image there.
can anyone explain how to code ai in a way that my pea brain will understand?
By acredb, with 1 reply.
Replied to by danpost, over 2 years ago:
acredb wrote...
basically i'm really stupid and can barely understand the syntax errors that i'm getting. << Code Omitted >> and if i try to fix one syntax error, another pops up, and so on no clue how to fix it, been on someone else's thread and i could barely read what was on the screen, everything kinda blurs together
The
Greenfoot.start()
method has a
void
return type. You cannot reference a
void
or compare it with anything. Also, the equal comparison operator is a double equal sign ( == ), not a single one ( = ).
How to add actors in the same place as before
By RandomGuy, with 2 replies.
Last reply by RandomGuy, over 2 years ago:
Dude thank you so much!
I need an actor to follow an other actor
By gijsdevries, with 2 replies.
Last reply by danpost, over 2 years ago:
gijsdevries wrote...
<Code Omitted>
The condition here will ALWAYS be
true
(if you have a class called
Player
).
I want an actor to apply a "rooted" status condition when it touches another actor
By KCee, with 5 replies.
Last reply by danpost, over 2 years ago:
KCee wrote...
Here is the SuperSmoothMover class: << Code Omitted >>
Okay. Try the following for line 35: <Code Omitted>
triangles
By LucarioCodes, with 6 replies.
Last reply by danpost, over 2 years ago:
LucarioCodes wrote...
Oh, thanks, sorry, I'm new to greenfoot
Line 10 should end with an opening bracket --
{
why doesn't my code work
By Magzlum, with 9 replies.
Last reply by danpost, over 2 years ago:
Magzlum wrote...
do you have a good and easy idea for a game that i can make for school
Avoiders are the easiest type to create. Adding some type of shielding might be an easy idea. Or, you could add shooting ability to the player, which would be a slight step up. You could continue to add other options later, which again will be stepping up.
code has error
By Merten, with 3 replies.
Last reply by danpost, over 2 years ago:
Merten wrote...
i<Code Omitted>
This code, in your
Fighter_Kogel
class, should be removed if you want the instances to move and get removed at edges like a
Kogel
instance is programmed to do. As an alternative, you could change it to: <Code Omitted>
Call getIntersectingObjects() from a subclass of World
By MRCampbell, with 1 reply.
Replied to by danpost, over 2 years ago:
MRCampbell wrote...
getIntersectingObjects() is protected, so I can not call it from a subclass of World. I was reading the article below... << Link Omitted >> and would love some more context and to know if there is anyway around it.
I do not know what more can be said about accessibility. However, to get "around it", you could add a new method in the class of the actor to call the method and return its results: <Code Omitted>Then call this method from the world subclass.
How to fix shaking objects
By Armetor, with 4 replies.
Last reply by Armetor, over 2 years ago:
Ohhhh ok that makes sense. Thank you so much!
Dark Maze
By CookieMonster, with 3 replies.
Last reply by danpost, over 2 years ago:
One way is demonstrated in my new scenario,
Dark Maze Demo
The
Light
class in the scenario (in the
Player
class) was modified to allow changing the range of illumination (strength of light). Also, the
Scroller
class was fitted to support non-scrolling areas along right and bottom edges of the world (a
crop
method was added).
Greyscaling an image
By LucarioCodes, with 2 replies.
Last reply by danpost, over 2 years ago:
LucarioCodes wrote...
Trying to make an image gray like an old photo, but I'm stuck. This is the code I have so far, where do I go from here?
Not tested, but I believe if you just add the three color parts together and divide by 3, then use that value for all three parts should be close to what you want: <Code Omitted>
Ok new problem
By SeargentMitchell, with 2 replies.
Last reply by SeargentMitchell, over 2 years ago:
thanks bruv
24
25
26
27
28
29
30
X