This site requires JavaScript, please enable it in your browser!
Greenfoot back

What is happening right now?


reply to How do I pixelate my background in Greenfoot?

By Zweeg - about 1 hour ago
I don't know how to write the code to pixelate it.

reply to Midterm project - wanting to make a rhythm game of sorts

By Vercility - about 1 hour ago
I'm just gonna asume you know the basics of java else this would be pretty pointless. U can check arrow keys with <Code Omitted> U can turn your actor with <Code Omitted> Movement : <Code Omitted> Changing their speed randomly is a bit more complicated so we'll handle that later Regarding 4 : Are they just supposed to change direction or change which direction they come from? e.g east -> middle to west -> middle or east->South? Regardless, this isn't harder than the previous tasks
My idea is to have some sort of counter that counts up every half or quarter-second, and when it hits certain numbers (it goes up indefinitely) it spawns the arrows? That seems like it would take forever to individually code the counters for the arrows, though.
No. The problem is just that you cant exactly set the counter time because greenfoot has no wait method for seconds, you can just run a while loop that increments an integer and when it hits a certain value you reset it and spawn an arrow (randomly)

reply to Need help with spamming game

By iminblue - about 5 hours ago
danpost wrote...
Allow 4 values for the 'ok' field -- namely '0', '1', '2' and '3'. Then you can increment it when a key is detected and increment it again when the key is released. Only move when the value is even. When it is '0' accept one of the keys and when it is '2' accept the other. Increment its value when moving and when the last movement key is released. Set it back to '0' instead of the increment to '4'. The following is the basic idea without your framing and whatever 'nr' does: <Code Omitted>
Thank you so much man it worked ! Appreciate the help ! Have a good day !

reply to Inserting an array into an array?

By danpost - about 10 hours ago
Xolkiyr wrote...
I figured out a way to do the world without having to set another part of the array. When the character initializes I setup a seperate 5x5x2 array that holds the limits of each "world" in the worldChunkOre variable so that when I need to call a particular worldChunk I don't have to cycle through the entire worldChunkOre array. This is more or less how both arrays look. << Code Omitted >> Does that all sound about right?
Still seems a bit over-complicated. I was thinking that if the ore actors saved their location in the world, then all you would have to do is list the ore objects in a one-dimensional array. Because each world originally has up to 12 ore objects, the first 12 would be for world00, the next 12 for world01, etc. If you have worlds that are 5x5 then the sixth group of 12 would be for world10, and so on. To help save on memory usage, you can set the image of empty veins to 'null'.

reply to How can you create random maths questions to pop up?

By Yehuda - about 13 hours ago
Also, I see that people use a JOptionPane, but it would be easier to use Greenfoot.ask, and the JOptionPane cannot be converted into HTML 5.