*Updated* Terrain Generator

by DevonX


Posted on January 16, 2007 at 3:53 AM



Just a simple terrain generator. I'm not going to write a long description, because nobody ever reads them until after they've look at the example. Space generats a new terrain.

*UPDATE* Alright, now any of you whos graphics card makes this mess up after about 20 presses, it is now fixed. Also, at smaksak, you can drop balls on the terrain and the are destroyed when they hit, just to show how to add some collision with this. As a little bonus, in a min, I'll upload one with an example of how to place say a tank on this and have it rotate to the terrain depending on the slope.

*UPDATE2* Now I have added a little example so you can drive a little tank around on the terrain. Read above for a little better description. Use left and riht to move. I have also showed that you can use different backgrounds as terrain textures to make look like your own.


zagster commented January 16, 2007 at 3:56 AM
Nifty program for designing stuff. 9/10
Xxypher commented January 16, 2007 at 4:10 AM
pretty useful for those games that never end
lol
8/10
SquareWheel commented January 16, 2007 at 4:58 AM
Decent but simple. It also had a bug which you probaly could have easily fixed. 7/10
Siert commented January 16, 2007 at 12:26 PM
Very nice, just to bad it always repeats.
smaksak commented January 16, 2007 at 5:56 PM
eh the ground isn't "collisionable", what can you use it for? >_>
Nilz commented January 16, 2007 at 7:28 PM
Smaksak, you can make it "collisionable" by making a sprite for it out of the surface :)
biggoron commented January 16, 2007 at 8:37 PM
Yeah, you need a terrain_free() function.
Kaz commented January 16, 2007 at 8:47 PM
Eh... It's ok I guess. After you press space 20 times it says Trying to use non-existing surface or something like that. 5/10
Quote
Thats because you're graphics card can't handle that much.
marbs commented January 16, 2007 at 9:18 PM

Smaksak, you can make it "collisionable" by making a sprite for it out of the surface :)
Quote
Yup, by using:

sprite_create_from_surface()

But it is indredibly slow, unfortunately...


And yeah, you need to surface_free().
gtvg commented January 16, 2007 at 10:19 PM
Not the best. It messed up after 32 presses. I know, it's becuase of my graphic card.
6/10
DevonX commented January 16, 2007 at 11:24 PM
if you replace that background it includes, you can have your own textures put in, just name it the same as whats already on there.
DevonX commented January 17, 2007 at 12:40 AM
terrain_free(); script added.
Anubis 208 commented January 17, 2007 at 1:22 AM
I agree with zagster. 9/10
Wommelbammer commented January 17, 2007 at 2:14 AM
Ok... The update wasnt perfect... When the "thing" left the room, this popped up.

Error in
action number 1
of Step Event
for object obj_thing:

Error in code at line 19:

if(y2 >= global.t_height[x2])

at position 20: Unkown variable t_heitght or array index out of bounds
DarkSoulcalibur commented January 17, 2007 at 2:49 AM
its pretty kool...i cant find a use for it, but it runs smoothly. 8/10
SquareWheel commented January 17, 2007 at 10:00 AM
The update is much better. Wommelbammer, he could have easily fixed that. but even I can see how un-important it is.
Episonage commented January 17, 2007 at 1:08 PM
Great example, I've been looking for this for a loooooooong time.
DevonX commented January 17, 2007 at 11:00 PM
thnx for the nice comments all.
ampou commented January 25, 2007 at 5:05 PM
Pretty cool! keep up the good work ;) 10/10
Casshern commented June 03, 2007 at 11:19 PM
awesome example man! :D
this is gonna be SUCH a big help for my game...especially the tank thing!
but i just need to fiddle around with the codes..and its proving to be slightly difficult lol
10/10 definitely