Yet another terrain generator...

Post your own tutorials, guides and demos.

Post » Mon Jun 20, 2011 8:36 am

Yes, it's another one. Except this ones a little different. I don't (yet) know much about arrays, or things such as that, but I wanted to create a sort of terrain generator that created a random terrain for a side scrolling "survival game". So I created the most simple one I could think of.

This is created only with a single "rock" object, with ten image points on random spots, and each rock at the beginning of the layout spawns another rock at a random angle and image point, which in turns spawns another rock etc... until 4 seconds, and each rock stops spawning more rocks, and the "terrain" is complete. After that, the rocks are pasted onto a canvas object and deleted, which makes the game run far faster than having hundreds of rock objects on the screen.



I know its not as fancy or good as the other countless generators on this forum, but I thought it worked OK and it works well anyway for the game I'm building. It's also not very efficient, but, tell me what you think! :o

CAP:
http://dl.dropbox.com/u/31490769/terraingen.zip
B
8
S
2
G
2
Posts: 144
Reputation: 1,588

Post » Mon Jun 20, 2011 8:42 am

one question. is there a limit with size of canvas object?
If your layout is 5000x480 and you generate your objects, and then save them as canvas it will create one giant texture in canvas. Am i thinking corectly?
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Mon Jun 20, 2011 9:29 am

Well... it should. But I'm having the problem of the canvas only actually "grabbing" the screen size. In other words, if you try and create a much bigger terrain than the screen size the canvas will still only grab the texture of the screen size. Uh... I hope that made sense... :P

Basically, if the layout was 5000x480, and the screen size was only 1024x768, the canvas would only end up grabbing 1024x768 of the terrain, and the rest would delete itself. I'm not sure if I'm doing something wrong, there's got to be some way to increase the canvas size. Anyone know how? :?
B
8
S
2
G
2
Posts: 144
Reputation: 1,588

Post » Mon Jun 20, 2011 9:49 am

Canvas uses the gpu, and since all textures not on the screen are not drawn.....
Canvas draw point, or line on the other hand....
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Mon Jun 20, 2011 11:57 am

I'm not sure I understand...
B
8
S
2
G
2
Posts: 144
Reputation: 1,588

Post » Tue Mar 05, 2013 1:03 pm

hey man!! why can't I open your files of terrain generation? they are vey interesting for my project!
B
3
Posts: 9
Reputation: 343

Post » Wed Mar 06, 2013 2:38 am

You can't open it because it is a file for construct classic, this thread hasn't been active for nearly 2 years.
B
7
S
3
G
1
Posts: 12
Reputation: 1,214

Post » Tue Mar 26, 2013 3:30 am

Still an interesting idea though. Wasn't aware you could do that. :)

B
8
S
2
Posts: 63
Reputation: 1,223


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 2 guests