Discuss Scratch

sc10071942
Scratcher
25 posts

Tiles Terrain Generator

I know how to make a tiles terrain generator, but I don't know how to make it generate so quickly. Mine has to change x, change y, switch costume and everything, instead of it doing all of that in a split second. What I'm saying is, does anyone know how to make a TTG with it generating really quickly? Thanks!

Scratch is awesome! Go Scratchers!

when green flag clicked
forever

if <(Scratch) = [awesome ]> then

say [Obviously! Everyone loves Scratch!]


end

end
ErnieParke
Scratcher
1000+ posts

Tiles Terrain Generator

Yes. Have you ever heard of custom blocks? To speed things up, you could do this:

when gf clicked
repeat (10)
Draw me some blocks!
end

define Draw me some blocks!
repeat (10)
//Your terrain generation code.
end

If you make the custom block run without a screen refresh, then the custom block will run once every frame. You'll be drawing 10 blocks per frame, or 300 per second!

There is one niche. If you make the custom block do too much work, it can make the game feel like it's lagging (and then it'll take more time to generate terrain then before).

Does this sound useful?

Helping,

ErnieParke

sc10071942
Scratcher
25 posts

Tiles Terrain Generator

ErnieParke wrote:

Yes. Have you ever heard of custom blocks? To speed things up, you could do this:

when gf clicked
repeat (10)
Draw me some blocks!
end

define Draw me some blocks!
repeat (10)
//Your terrain generation code.
end

If you make the custom block run without a screen refresh, then the custom block will run once every frame. You'll be drawing 10 blocks per frame, or 300 per second!

There is one niche. If you make the custom block do too much work, it can make the game feel like it's lagging (and then it'll take more time to generate terrain then before).

Does this sound useful?

Helping,

ErnieParke

Thanks so much! I always kept screen refresh on, mostly because I didn't know what it meant. Anyway, thanks! It should work now.

Scratch is awesome! Go Scratchers!

when green flag clicked
forever

if <(Scratch) = [awesome ]> then

say [Obviously! Everyone loves Scratch!]


end

end
herobrineawsomeness
Scratcher
11 posts

Tiles Terrain Generator

it's easy to generate tiles.
just use this script.
when green flag clicked
repeat (48)
change x by (10)
stamp

end
repeat (15)
change y by (-1)
stamp

end
repeat (48)
change x by (-10)
stamp

end
repeat (15)
change y by (-1)
stamp

end
duplicate the scripts so the tiles will move further down.
so say if you wanted to change costumes. just put a switch costume block anywhere in the stack.
when green flag clicked
repeat (48)
change x by (10)
stamp

end
repeat (15)
change y by (-1)
stamp

end
switch costume to [costume2]
repeat (48)
change x by (-10)
stamp

end
repeat (15)
change y by (-1)
stamp

end
now you can create tile terrain generators!
if you want to see mine, go to my Terraria Terrain Generator.
Paddle2See
Scratch Team
1000+ posts

Tiles Terrain Generator

Since this topic hasn't seen a new post from the topic owner in a long time, I'm going to assume that it is dead and close the topic. If it still is alive, the topic owner just needs to use the Report button to ask a mod to reopen it

Scratch Team Member, kayak and pickleball enthusiast, cat caregiver.

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.
(credit to Za-Chary)



;

Powered by DjangoBB