Pixel terrain generator


I need to create pixel map like this (http://s15.postimage.org/t8p356cij/terrain.png). Problem is that map is lagre and each “pixel” must have 2 values. On screen is drawing only about 2% of map. I tried many methods but all of them are very slowly. Can somebody post some good methods to code this? Thanks

Can you post your code? Then sby can tell you how to improve it.

First off, I did the same thing initally with a pixmap, and it IS very slow, expecially when you start doing scaling on a per-pixel basis.

Instead, you should look at making a mesh that is the texture of each specific type of pixel. So, for pixel type 1, draw mesh 1, etc. .Then blast meshes() at the screen from a table in a for loop. This is incredibly fast compared to sprites, for example.

Thanks @aciolino works great!

One more question; there are not any possibilities to draw one rectangle from mash?

.@Cabernet - have a look at the setRect and addRect functions: http://twolivesleft.com/Codea/Reference/#detail/index/mesh.addRect

You’re best off making a lot of one rectagle meshes, just as Reefwing linked.

Thanks everybody again,

here is little example of my game(Tunneler)


Looks neat, @Cabernet. You’ve made a lot of progress.

That looks like great fun, @Cabernet