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

danpost's Comments

Back to danpost's profile

Since each keypress is to produce one letter, you really should use the 'getKey' method instead of the 'isKeyDown' method, which can cause more than one character to be added to the string on a keypress.
Just to clarify: switch a bulb on or off by clicking on it, and all the bulbs next to it, horizontally and/or vertically, switch states (from on to off, or from off to on, depending on their starting state). It is part of the all-ones collection of games, so, yes, the object is to turn them all on.
Encountered a situation in the level with the row of invinsible bricks. If no breakable bricks remain in the general area above the unbreakables, the ball can bounce back and forth repeatedly in the same pattern and will not ever return to the bottom half of the screen. A random, but infrequent, small turn could fix this.
You need to change 'isKeyDown' to 'getKey'.
I just made my world equal in size to yours (800, 400, 1). I way overdid the number of tile objects needed; as before I could easily have gotten away with less then half of what I had. Still, my tile array, now, is 55x30, which is 1650 (about half of what I had). I think the reason I had so many before, was that I did not want the pattern to repeat so quickly. Anyway, there is very little, if noticable, lag.
My version created 3200 16x16 tiles objects, and move all of them on each movement. It then relocates any tile that are way off the screen to the opposite side; always keeping a full background in view. No image manipulating required.
Hey sp33dy, just a quick question. You are not repainting the tile objects, are you?
@erdelf, the score-code/scoreboard/highscores is something that comes with the newest version of Greenfoot (v. 2.2.0 and up). You should be able to import the code directly.
It would be much faster to have an Actor 'Tile' class in an unbounded world. Then the world can move all the tile actors in the appropriate direction when a key is held down. I have a sample scenario, if you want to see.