I'm working on a college project atusing the minuteeducational Java framework Greenfoot, and as stated above we're making an r-type clone.
I've been looking at using an array of strings to populate the levels. The array contains 60 strings, filling the Y axis, each element in the array represents a y co-ordinate += 10. I use "0" to represent empty space, "1" to represent a block of terrain.
Then I use a for loop and charAt() method to create a new array representing each column along the X axis, and populate the screen this way.
I thought I was being clever by making a "block" class that checked to see if it was connected to any other blocks and adjust it's image accordingly to make the terrain look as if it's a single block/shape. However, this is now slowing down the game to a crawl as there are so many objects in it.
I've tried to add the columns as the game is scrolling and removing them once they leave the screen, but I end up with gaps in the terrain.
How are levels in these types of game normally implemented? Would I be better creating a few big objects to make the terrain and build the whole level from start to finish?
Is there some method I've completely missed?
Here is a screen shot of how it looks at the minute, each block is 22 x 10 pixels.
