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
raising speed by score
By intanmuliawati, with 1 reply.
Replied to by danpost, over 8 years ago:
intanmuliawati wrote...
I have a counter class to calculate the score. How to increase the number of enemy when the score reaches a multiple of 15?
Currently, you are creating an enemy after every 150 act steps. To increase the spawn rate, you would lower that number. If the score is to be what determines how much to lower that number, then you would need to subtract some expression of the score from it. You would need to consider what multiple of (score/15) to lessen it by. What value you choose will effect the game duration as well as what possible maximum score may be achieved.
How do I reference an array?
By Astralman, with 7 replies.
Last reply by Astralman, over 8 years ago:
Got it. Thanks!
Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed. Error
By OfficerRiot, with 3 replies.
Last reply by OfficerRiot, over 8 years ago:
danpost wrote...
OfficerRiot wrote...
so I keep getting this error but every time the bullet gets removed it crashes and do this << Code Omitted >>
The
turn
method requires the actor be in the world as it use
getObjectsInRange
immediately. It will fail if the actor is removed by the
hit
method, which is called before
turrn
in the
act
method. Simple
act
method fix is to call
turn
first -- then call
hit
.
Actually, it seems like its still doing it
Music
By Heet_Patel, with 2 replies.
Last reply by Heet_Patel, over 8 years ago:
tnx i forgot
getRandomNumber
By intanmuliawati, with 2 replies.
Last reply by intanmuliawati, over 8 years ago:
thankyou so much danpost
Variable issue, in desperate need of help :l
By Javalicious, with 2 replies.
Last reply by danpost, over 8 years ago:
Javalicious wrote...
i'm trying to make a little dude that walks around with a 2 picture walking animation, but i cant seem to get it to do the second frame
You are creating new images every act cycle. So, first thing you should do is move, at minimum, lines 22 through 35 to outside the
act
method. Next thing I noticed was that you have 6 different variable for movement, which is way overboard; but, I won't get into that right now (as you just want a quick fix). Line 42 should probably be moved outside the
act
method, so if no keys are currently pressed, the last moveme
java and pseudocode Declaration
By Ticker175, with 4 replies.
Last reply by Ticker175, over 8 years ago:
That's exactly what i was looking for thanks for the help =)
Help with changing variables of the actor that has been shot at
By SPCWW, with 2 replies.
Last reply by SPCWW, over 8 years ago:
It worked! Thanks.
Actor moves random (german)
By Vizemesiter, with no replies.
Ich brauche unbedingt Hilfe bei meinen Hausaufgaben. Und zwar habe ich den Actor IronMan, dieser wird von einer Kugel eliminiert. Diese Kugeln (mehrere) sollen sich zufällig in meiner Welt bewegen, nur weiß ich nicht, wie man das macht. Ich bitte um Hilfe!
Password
By CarmanRose, with 3 replies.
Last reply by danpost, over 8 years ago:
CarmanRose wrote...
if(input == "password")
Here is the problem. You are taking two
String
objects and asking if they are the same object. That is, you are not asking about what the two distinct
String
objects contain as far as their characters. You compare the contents of two strings using the
equals
method: <Code Omitted>It is always best to put the literal (or known entity) first (so you are not calling a method on a
null
object).
Level complete
By XswimmerX1504, with 2 replies.
Last reply by XswimmerX1504, over 8 years ago:
Thank you.
Is it possible to read and write to a file?
By Xolkiyr, with 4 replies.
Last reply by Xolkiyr, over 8 years ago:
danpost wrote...
Xolkiyr wrote...
What about a mysql database?
I suggest you experiment to find out. It is the best way to learn what is possible and what is not.
touché
How do I reference an actor's integer to the world
By Lavenger, with 18 replies.
Last reply by danpost, over 8 years ago:
Yehuda wrote...
...as you were instructed, and yes, the "addedToWorld" method is overriding an already existing method with that name just like the "act" method does.
... and is called by the greenfoot framework on actors when added into a world.
Angles in Rotation Limit
By Applez, with 4 replies.
Last reply by danpost, over 8 years ago:
Applez wrote...
Thanks, and how do I make cars randomly spawn?
Well, you probably do no want cars to spawn on each other, so using a random timer would probably be best. Something like this: <Code Omitted>In line 8, the added value, 30, is the minimum delay time and the random part, 150 is the variable delay range beyond the initial 30.
How do I make my score go up by one?
By applecider124, with 2 replies.
Last reply by applecider124, over 8 years ago:
danpost wrote...
How about this for line 72: <Code Omitted>Only thing is, if you stop the program (line 71), the Counter object image will not update.
Thank you!
258
259
260
261
262
263
264
X