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
trouble with superclasses
By genju, with 1 reply.
Replied to by Super_Hippo, about 6 years ago:
Your Soldier class has one constructor. The one with a bunch of parameters. The subclasses should have a constructor which exists in the super class. So you could either create a constructor in the Soldier class without parameters. And/or the subclasses constructors should match. So the constructor of your Heavy class could look like this.
Maze generator not working properly.
By EvanRoscTheDev, with 4 replies.
Last reply by danpost, about 6 years ago:
Apparently,
rand
is alternating between 0 and 1 inside the
do
loop, making
x
add and subtract; add and subtract. You need to be very careful with loops and make sure that they will eventually, at some point, be broken out of. Unfortunately, your coding is (1) undocumented; (2) bulky, and not easily readable; and (3) unfactored; -- making it virtually impossible to see what is going on (especially for an outsider). All I can say at this point is that you need better control of the flow within the loop. A visited cell should not be re-visited.
How to increase my score by increments of 1000
By HairyChickens, with 4 replies.
Last reply by HairyChickens, about 6 years ago:
danpost wrote...
HairyChickens wrote...
Thanks for the quick reply but do you mind showing me exactly what I should type for the addedToWorld method and the multiply 1000. This is my first time playing with coding and I'm not familiar it yet :)
The method would look like this: <Code Omitted>An example of multiplying would be taking "score" in line 29 and replacing it with "(score*1000)".
Thank you so much!!!!
How would I display score from another world class?
By DaRafster, with 4 replies.
Last reply by DaRafster, about 6 years ago:
danpost wrote...
Switch lines 17 and 19.
Thank you, this prepare method at the bottom has become a habit for me. I really should bring it up to the top!
How to reverse String?
By JJ24, with 3 replies.
Last reply by danpost, about 6 years ago:
Ways to reverse it yourself might include: <Code Omitted>or <Code Omitted>("resu" is "user" backwards, if you were wondering)
World not being set
By DaRafster, with 7 replies.
Last reply by DaRafster, about 6 years ago:
Sorry, I no longer need to address this problem. This post took a long time to get approved, so I had to find my own way around it.
Actor won't spawn?
By Cooleb, with 9 replies.
Last reply by danpost, about 6 years ago:
When your MyWorld object (or, your world) is created, the initial value of
friendClicked
is set to zero by line 107 (fields are created and set to their initial values before the constructor is executed). Since a constructor is only executed once per object created, the condition on line 31 will always be
true
and the
else
part of that
if-else
structure will never execute. Anything done after initial creation of an object cannot feasibly be coded in the constructor. Sometimes, some finalizing set-up is required once an actor is added to a world or when a world is
Null pointer exception
By scaps, with 1 reply.
Replied to by Super_Hippo, about 6 years ago:
Change ‘world’ in line 20 to ‘getWorld()’. You might want to change ‘projectile’ to ‘new Projectile()’ as well.
Read a text file with Scanner class
By Fargesia, with 17 replies.
Last reply by Fargesia, about 6 years ago:
Ok works fine now, thank you guys!
Making the hearts disappear (Lives) HELP PLEASE
By xlama, with 4 replies.
Last reply by danpost, about 6 years ago:
xlama wrote...
I tried that but it would just remove them all at once and stops the game.
Okay. Possible solutions are (1) you could just remove the car collided with; or (2) you could create another class to take the image of collided car and replace the car with it.
Scrolling
By AdiBak, with 1 reply.
Replied to by danpost, about 6 years ago:
Please refer to my
Scrolling Tutorial
scenario.
Making one new bird object when an existing bird object touches bottom of world
By BigBoy123, with 2 replies.
Last reply by Dr.Blythe, about 6 years ago:
*ahem*, really?
Why is is not returning time
By DaRafster, with 7 replies.
Last reply by danpost, about 6 years ago:
DaRafster wrote...
The world that the enemySpacecraft actor is in is a world subclass of Galaxy. So would this still be the same thing? Would I have to access the timer from the original world?
That was little confusing -- as what would be the "original world". At any rate, let me explain this way. When you extend a class, what you are doing is creating a union of classes to describe the same type object as the class being extended creates. The extending class can add new possible states (fields) for the object or add, modify and/or remove behaviors that the object can do (by adding
Is it too shaggy?
By CHEGAMERXD, with no replies.
<Code Omitted>
I want to code on Roblox but I can't open Roblox Studio
By CHEGAMERXD, with 1 reply.
Replied to by CHEGAMERXD, about 6 years ago:
OK I think my PC is old I think i cant run it :(
Dang
idk
129
130
131
132
133
134
135
X